Loop never ends
I guess you were using the "Do While...Loop". There are 2 ways to tackle this problem. First, you could use a finite loop "For i = 1 to n... Next i" but you would then have to find out how many rows you have for looping; Second, you could use "Do While... Loop" with with "ISEMPTY()" here's how I would do it:
i=0
Do while isempty([A1].offset(i,0))=false
'Programming codes.....
i=i+1
Loop
This will go through each cell in column A until it reaches the first empty cell. Obviously, in this case, I would have to assume that all cells in Column A is not blank.
"useless at looping!" wrote:
I have a macro that I run every month which calculates commission and one of columns in my spreadsheets uses vlookup. I would like the macro to paste the vlookup command I am using into cells in column AD only if the cell in column AC is not blank. I have tried creating loops but they either stop after pasting into the first cell or continue on forever.
Anyone who can help? It would be greatly appreciated!!!
|