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

Test for a Blank Cell Below Active Cell

Status
Not open for further replies.

Vamphyri

Technical User
Mar 18, 2005
60
US
I have been searching for this one quite a bit, but cannot find exactly what I'm looking for.

I need to figure out how to test for a blank cell, using OFFSET, 1 row below th eactive cell.

Here's what I came up with:

Code:
If Offset(0, 1) = "" Then
            Exit Sub
        Else

Unfortunately, the code errors out on the first line with "Sub or Function Not Defined".

Any ideas on how to do this one?

Thanks


In the immortal words of Socrates, who said:
"I drank what?
 
If ActiveCell.Offset(0, 1) = "" Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
how to test for a blank cell

Cells with blank (aka space) differ from empty cells.


are you looking for a cell with a blank (like if you hit the space bar while in the cell, or you deleted the contents of a cell)

OR one with a null value (has never been populated or has been set to null)

 





If you are looking for an empty cell below the activecell...
Code:
if activecell.offset(1) = "" then
If you are looking for an empty cell to the right of the activecell...
Code:
if activecell.offset(0,1) = "" then




Skip,

[glasses]Have you heard that the roundest knight at King Arthur's round table was...
Sir Cumference![tongue]
 
mscallisto,
In Excel, =IsBlank(CellRef) returns TRUE if the cell is empty, whether it has always been null or the contents have been deleted. So a cell containing one "space" character (ie chr(32) or " ") is not considered a Blank cell.

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
PHV,

Excellent!

Thanks


In the immortal words of Socrates, who said:
"I drank what?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top