ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking if worksheet is blank (https://www.excelbanter.com/excel-programming/281142-checking-if-worksheet-blank.html)

Tommi[_2_]

Checking if worksheet is blank
 
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



Tom Ogilvy

Checking if worksheet is blank
 
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.

--
Regards,
Tom Ogilvy


"Tommi" wrote in message
...
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





J.E. McGimpsey

Checking if worksheet is blank
 
one way:

Dim blank As Boolean
blank = Application.CountA(Worksheets("Sheet1").Cells) = 0


In article ,
"Tommi" wrote:

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



Alan Webb[_3_]

Checking if worksheet is blank
 
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



All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com