PDA

View Full Version : How to use "For loop" until the cell.value becomes null?



prshnthvn
03-27-2010, 06:54 AM
Hello Everyone,

Can you please let me know, how to use "For loop" until the cell.value becomes null?

Thanks in advance,
Regards,
Prashanth.

mdmackillop
03-27-2010, 07:02 AM
For each cel in Range
If cel = "" then Exit For
'Do Stuff
Next


Slight variations for a Do..Loop

Sub test()
Do
i = i + 1
Debug.Print Cells(i, 1)
Loop Until Cells(i + 1, 1) = ""
End Sub

Sub test2()
i = 1
Do Until Cells(i, 1) = ""
Debug.Print Cells(i, 1)
i = i + 1
Loop
End Sub