Solved

Loop until Cell is empty

Posted on 2004-10-11
3
263 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 125 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now