Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default check if worksheet is empty

Hi,
how can i check if worksheets labeled sheet2, sheet3 and sheet4 is
empty?
thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default check if worksheet is empty

One way

If Application.WorksheetFunction.CountA(sheets("Sheet 2").Cells) = 0 Then

If 0 there is no data on the sheet

Here is a working example to delete empty sheets

Sub Delete_EmptySheets()
Dim sh As Worksheet 'Ron de Bruin, programming, 2002-12-28
'On Error Resume Next 'possibility of all sheets blank
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
'On Error goto 0 'Excel must have one sheet/workbook
End Sub



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


"Lynn" wrote in message oups.com...
Hi,
how can i check if worksheets labeled sheet2, sheet3 and sheet4 is
empty?
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
Check for empty range in vba Phil Excel Discussion (Misc queries) 1 April 28th 06 09:57 PM
Check if Active Workbook is Empty scantor145[_18_] Excel Programming 1 July 26th 05 03:21 PM
Check if empty stevenmckeon[_4_] Excel Programming 2 August 2nd 04 08:29 AM
How to check for next empty cell in list DonW Excel Programming 3 December 27th 03 05:47 AM
vba - check if cell is empty joao Excel Programming 6 November 18th 03 03:12 PM


All times are GMT +1. The time now is 01:46 AM.

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"