View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Zack Barresse[_3_] Zack Barresse[_3_] is offline
external usenet poster
 
Posts: 101
Default Using IsBlank in VBA

If that's the case, just use ..

If WorksheetFunction.CountA(Cells) = 0 Then
msgbox "empty"
Else
msgbox "has data"
End If

The way you've shown, data can be in A1 and give a false positive.

HTH

--
Regards,
Zack Barresse, aka firefytr


"Ikaabod" wrote in
message ...

I just realized that you might have been asking if the entire worksheet
is empty... one way to check is the following code:

Sub test()
If ActiveSheet.UsedRange.Cells.Address = "$A$1" And
ActiveSheet.Range("A1").Value = "" Then
MsgBox "Clear"
Else
MsgBox "Not Clear"
End If
End Sub


--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile:
http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=537027