View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Is Worksheet Empty?

The only problem is :

What does Empty mean??

If a worksheet has many inserted comments and nothing else, COUNTA will
ignore them, but Activesheet.Usedrange will not.

If a worksheet has many cells with the background color set and nothing
else, COUNTA will ignore them, but Activesheet.Usedrange will not.

If a worksheet has ClipArt and nothing else, both COUNTA and
Activesheet.UsedRange will tell you nothing is there!
--
Gary''s Student - gsnu200745


"Zone" wrote:

Cool, Thanks! A question. It seems to work just as well like this.
Sub zone()
MsgBox WorksheetFunction.CountA(Cells)
End Sub
Any problem with this? James

"Gary''s Student" wrote in message
...
Sub zone()
MsgBox (Application.WorksheetFunction.CountA(Cells))
End Sub

will report 0 on an empty sheet
--
Gary''s Student - gsnu200745


"Zone" wrote:

I found that if a worksheet is completely empty, its UsedRange will be
$A$1.
Then if A1 is empty, the worksheet is blank. But it seems there should
be a
more elegant way to determine whether the worksheet is blank. TIA, James