Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Loop until Cell is empty

Posted on 2004-10-11
3
Medium Priority
?
283 Views
Last Modified: 2010-05-18
I am having trouble with a simple do/loop.  I want to loop until there is no value in the cell in column C.  Here is what I currently have:

Counter = 2
 
 Do
 Range("D" & Counter).Select
 Range("D" & Counter) = Range("Change!C9")
 Counter = Counter + 1
 Loop While ("C" & Counter) <> Null


This results in the first cell 'D2' being filled in but no other cells in row D.

I have tried Loop Until- this results in a never ending loop.  I have also tried
Loop While ("C" & Counter) <> ""- this results in a never ending loop.


Can anyone tell me what I am doing wrong.
0
Comment
Question by:slattbr
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Data-Man earned 500 total points
ID: 12281588
Change your loop to check for an empty string

While Range("C" & Counter) <>""


Mike
0
 

Author Comment

by:slattbr
ID: 12281704
Entered

 Do While Range("C" & Counter) <> ""
 
 Range("D" & Counter).Select
 Range("D" & Counter) = Range("Change!C9")
 Counter = Counter + 1
 Loop

and worked perfectly.

thanks mike
0
 
LVL 18

Expert Comment

by:Data-Man
ID: 12281765
you are welcome....Mike
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question