How to check cell has a value.

C

Craig & Co.

Hi,

Is it possible to check the value of a cell for data?

Using a for counter = 0 to MaxSize loop
I use the ActiveCell.Offset(-1,Counter).Interior.ColorIndex = 6

I want to check the Offset (-2,Counter) to see if it's blank, how can I do
this?

Cheers
Craig.
 
A

Alan Beban

Myrna said:
If IsEmpty(ActiveCell.Offset(-2, Counter) Then

This will return True if the cell is either blank or contains an empty
string; if a return of True is desired only if the cell is blank
(including that it not contain an empty string) consider

If Application.CountIf(Range("relevant cell"), "=") <> 0 Then
MsgBox "Empty"
Else
MsgBox "Not Empty"
End If

Alan Beban
 
D

Dave Peterson

I think that isempty() only returns true if the cell is really empty--if there
is a zero length string (') in the cell, I get False:

Option Explicit
Sub testme01()
ActiveCell.ClearContents
Debug.Print "before: " & IsEmpty(ActiveCell)
ActiveCell.Value = "'"
Debug.Print "after: " & IsEmpty(ActiveCell)
End Sub

before: True
after: False
 
Top