Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ActiveSheet is blank

What is the easiest way to check if the ActiveSheet isblank? I want to loop
through the sheets collection and delete all empty sheets.

thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default ActiveSheet is blank

This illustrates one way:

If Application.CountA(ActiveSheet.UsedRange) = 0 Then
MsgBox "Sheet is empty"
End If


--
Jim Rech
Excel MVP
"Stitch45" wrote in message
...
What is the easiest way to check if the ActiveSheet isblank? I want to
loop through the sheets collection and delete all empty sheets.

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ActiveSheet is blank

for each sh in ActiveWorkbook.worksheets
if application.countA(sh.cells) = 0 then
Application.DisplayAlerts = False
sh.Delete
application.DisplayAlerts = True
end if
Next



--
Regards,
Tom Ogilvy

"Stitch45" wrote in message
...
What is the easiest way to check if the ActiveSheet isblank? I want to

loop
through the sheets collection and delete all empty sheets.

thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default ActiveSheet is blank

Try this one
Sub Delete_EmptySheets()
Dim sh As Worksheet 'Ron de Bruin, programming, 2002-12-28
For Each sh In ThisWorkbook.Worksheets
If Application.WorksheetFunction.CountA(sh.Cells) = 0 Then
Application.DisplayAlerts = False
sh.Delete
Application.DisplayAlerts = True
End If
Next
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Stitch45" wrote in message ...
What is the easiest way to check if the ActiveSheet isblank? I want to loop through the sheets collection and delete all empty
sheets.

thanks



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get ActiveSheet name in VB Geoff Lambert[_2_] Excel Programming 1 October 8th 04 02:25 PM
name of the activesheet rasta Excel Programming 1 October 3rd 03 09:49 PM
ActiveSheet.Name? Andrew Stedman Excel Programming 5 July 30th 03 01:17 PM
ActiveSheet Graham[_3_] Excel Programming 0 July 30th 03 09:08 AM
ActiveSheet Graham[_3_] Excel Programming 0 July 29th 03 04:47 PM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"