Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A zero in a cell is classed as an empty cell???? 1

Status
Not open for further replies.

LeighAnne

Technical User
Mar 8, 2002
65
GB
I am writing some VBA that contains the loop:

Do Until ActiveCell.Value = Empty
-
-
-
-
Loop

Unfortunately when the activecell value is "0", then "activecell.value = Empty" is true. How can this be correct? If there is a zero in the cell then it is not empty, it contains a zero. How can I rewrite this so that it checks if the cell is truly blank i.e. contains no data?
 
Try
Code:
Do until Trim(activecell.value) = ""

Loop
 
Or use :

Code:
Do until ActiveCell.Formula = Empty
.
.
.
Loop



Cheers, Glenn.

My grandfather was ill, and my grandmother smeared goose-grease on his back. He went downhill very quickly after that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top