$ 0 0 Never Mind. I fixed it. Instead of defining "i" in the Advanced UDF, I defined it as Global variable and then updated my code to below: Thanks