ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check if Active Workbook is Empty (https://www.excelbanter.com/excel-programming/335541-check-if-active-workbook-empty.html)

scantor145[_18_]

Check if Active Workbook is Empty
 

Excel 2003 with Visual Basic 6.3

I'm sure there must be a way to check and see if the Active Workbook is
empty.

Any clues?


--
scantor145
------------------------------------------------------------------------
scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=390186


Tom Ogilvy

Check if Active Workbook is Empty
 
What is your definition of empy?

Possibly

Dim bEmpty as Boolean, sh as Worksheet
bEmpty = True
for each sh in Activeworkbook.Worksheets
if Application.CountA(sh.UsedRange) < 0 then
bEmpty = False
Exit for
end if
Next
With ActiveWorkbook
if .Worksheets.count < .Sheets.count then _
bEmpty = False
End With
if bEmpty then
msgbox Activeworkbook.Name & " is empty"
end if

The above doesn't check for shapes/olebojects or code.

--
Regards,
Tom Ogilvy

"scantor145" wrote
in message ...

Excel 2003 with Visual Basic 6.3

I'm sure there must be a way to check and see if the Active Workbook is
empty.

Any clues?


--
scantor145
------------------------------------------------------------------------
scantor145's Profile:

http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=390186





All times are GMT +1. The time now is 09:18 AM.

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