Checking if worksheet is blank

  • Thread starter Thread starter Tommi
  • Start date Start date
T

Tommi

Hello!

I would like to know if there is a neat way to check if worksheet is totally
blank. Of course I could go through every cell and check its contents but is
there easier way?

BR,
Tommi
 
If isempty(Range("A1")) and ActiveSheet.UsedRange.count = 1 then

or

if Application.countA(Activesheet.cells) = 0 then

You may get different answers - if you mean an entry in any cell, then use
the latter.
 
one way:

Dim blank As Boolean
blank = Application.CountA(Worksheets("Sheet1").Cells) = 0
 
Might this do the trick for you?

Function BlankSheet() As Boolean
BlankSheet = False
If ActiveSheet.UsedRange.Address = "$A$1" Then
If Len(Trim(ActiveSheet.UsedRange)) = 0 Then
BlankSheet = True
End If
End If
End Function
 
Back
Top