Best way to check if cell is empty??

R

Robert Crandal

I currently use the following code to test if a cell is empty:

If IsEmpty(Sheet1.Range("A1").Value) then
' code here
End If

Are there better or other ways to check if a cell is empty???
Also, does it matter if I put the ".Value" at the end of the
Range("A1") code?

thankx
 
G

Gary''s Student

You do not need the .Value

However if the cell contains a Comment it Isempty() will still return True.
 
D

Don Guillett

Option Explicit
Sub checkcell()'Even takes care of touching the space bar
If Len(Application.Trim(Sheet1.Range("a1"))) < 1 Then
MsgBox "hi"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top