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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to tell if a Word Cell is empty? 1

Status
Not open for further replies.

dhover

Programmer
Oct 24, 2000
4
US
If there is no text in the cell, Selection.Cells(1).Range.Text = "" returns False.
Why? Because it actually contains a CRLF combination (the end of cell marker?). This can be seen by print the Asc() of the text to the debug window: Debug.Print Asc(Selection.Cells(1).Range.Text)
Now the really perplexing part, is that Debug.Print Selection.Cells(1).Range.Text = Chr(13) returns False.

What am I missing here? Is there an EndOfCell property that I've missed somewhere...or some other way to see if the cell is empty? Maybe I'm looking to hard.

In any case, thanks!
dhover
 
Very good! After I posted the question I realized I never checked TechNet. The suggestion there was also to check the length of the text. If it's 2 characters long, the cell is empty...go figure!

It is good to know that Chr(7) is the EndOfCell Marker.

Thanks for the help.
dhover
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top