Link to home
Start Free TrialLog in
Avatar of zmau
zmau

asked on

vbScript in Excel - How to run a macro until there are no more lines ?

Hi!

I have a macro (it does some work on the current line), and I want to run it  "until there are no more lines".

Basically I wany to have a macro that :
loop
1) Runs macro_A
2) Go down one line
until the current line is empty.
Thanks
zmau
Avatar of antontolentino
antontolentino
Flag of United Arab Emirates image

you can use something like this...

LastRow = ActiveSheet.UsedRange.Rows.Count

then feed the LastRow variable in loop. something like..

while currentRow is less than LastRow
do your macro

For added reference on determining last row visit http://www.mrexcel.com/td0058.html
Avatar of zmau
zmau

ASKER

Thanks,
How do I go down one line ?

zmau
ASKER CERTIFIED SOLUTION
Avatar of antontolentino
antontolentino
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial