I use this code for loops when I have up to 4 policy numbers in work that I want to get data for
pol1 = range("A1")
pol2 = range("A2")
pol3 = range("A3")
pol4 = range("A4")
polarray = array(pol1, Pol2, Pol3, Pol4)
Dim iPol as Integer
For iPol = 0 to 3
PolNo = Polarray(iPol)
'(your code to perform actions/get results)
Next iPol
Basically, if pol 2, 3 & 4 are blank it will only run once and so on.
there are other ways also depending on what you are trying to do,
another is to start your code with X = X + 1 and at the end say if X > 3 then end or else go back to start.
hope this helps
Bookmarks