Loops

C

cwilkin1

Hi, I know how to use a For Next Loop but I'm having a problem with the
Do While and the Do Until loops. I want the macro to execute until the
cell on the left is blank. Can someone help?

Thanks

Chuck
 
B

Bob Phillips

Do Until Activecell.Offset(0,-1).Value = ""
'do some stuff
Activecell.Offset(1,0).Select
Loop

or

Do While Activecell.Offset(0,-1).Value <> ""
'do some stuff
Activecell.Offset(1,0).Select
Loop

It is not really necessary to do the selecting, but that is another story.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
C

cwilkin1

Bob said:
Do Until Activecell.Offset(0,-1).Value = ""
'do some stuff
Activecell.Offset(1,0).Select
Loop

or

Do While Activecell.Offset(0,-1).Value <> ""
'do some stuff
Activecell.Offset(1,0).Select
Loop

It is not really necessary to do the selecting, but that is another story.


Bob, Thanks a lot it worked great

Chuck
 
Top