Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes, I understand what you mean. Concise wording of questions is so
important, yet so rare! Let's say I want to determine only whether the worksheet contains data in the cells. Then your COUNTA is ideal. What I really meant by my follow-up question is that I changed your code, leaving out Application. and the parentheses around the MsgBox's argument. I have a mania for compacting instructions into the shortest form possible. Do you see any problem with leaving out Application. and the extra parentheses? James "Gary''s Student" wrote in message ... 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Because "CountA" is a worksheet function, you must use "Application" in
front of it. But you can delete the "WorksheetFunction". HTH Otto "Zone" wrote in message ... Yes, I understand what you mean. Concise wording of questions is so important, yet so rare! Let's say I want to determine only whether the worksheet contains data in the cells. Then your COUNTA is ideal. What I really meant by my follow-up question is that I changed your code, leaving out Application. and the parentheses around the MsgBox's argument. I have a mania for compacting instructions into the shortest form possible. Do you see any problem with leaving out Application. and the extra parentheses? James "Gary''s Student" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why is worksheet.usedrange empty? | Excel Worksheet Functions | |||
empty box/worksheet | Excel Discussion (Misc queries) | |||
check if worksheet is empty | Excel Programming | |||
How do I delete an empty worksheet. | Excel Worksheet Functions | |||
XL VBA adding new worksheet if current worksheet is not empty | Excel Programming |