Solved

Loop until Cell is empty

Posted on 2004-10-11
3
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

615 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