#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Loops

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Loops

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)

wrote in message
ups.com...
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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default Loops


Bob Phillips wrote:
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



Bob, Thanks a lot it worked great

Chuck

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

wrote in message
ups.com...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
if function in excel should 12 loops Madhukar Excel Discussion (Misc queries) 2 September 7th 06 01:30 PM
Loops... Willabo Excel Discussion (Misc queries) 2 June 14th 06 04:08 PM
do loops saravanan Excel Worksheet Functions 0 June 13th 06 10:53 AM
For next loops Kate Excel Discussion (Misc queries) 5 May 22nd 06 01:11 PM
Max limit of 7 nested loops Subu Excel Worksheet Functions 2 May 28th 05 02:14 PM


All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"