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
LVL 1
zmauAsked:
Who is Participating?
 
antontolentinoConnect With a Mentor Commented:
The loop will move you down one line in every loop

 
LastRow = ActiveSheet.UsedRange.Rows.Count
For x = 1 to LastRow
      ...Do your thing...
next x

Open in new window

0
 
antontolentinoCommented:
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
0
 
zmauAuthor Commented:
Thanks,
How do I go down one line ?

zmau
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.