Closed Thread
Results 1 to 5 of 5

check if worksheet is empty

  1. #1
    Lynn
    Guest

    check if worksheet is empty

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


  2. #2
    Ron de Bruin
    Guest

    Re: check if worksheet is empty

    One way

    If Application.WorksheetFunction.CountA(sheets("Sheet2").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" <moley_cruz@yahoo.com.au> wrote in message news:1129040925.060551.317060@g49g2000cwa.googlegroups.com...
    > Hi,
    > how can i check if worksheets labeled sheet2, sheet3 and sheet4 is
    > empty?
    > thanks
    >




  3. #3
    Registered User
    Join Date
    03-29-2018
    Location
    Singapore
    MS-Off Ver
    9
    Posts
    60

    Re: check if worksheet is empty

    Hi there this is a super old thread but it solves my problem.

    Instead of deleting each empty worksheet, how do I make it total the number of empty worksheets in my workbook and output
    the data in a cell in worksheet named "Initial Analysis"

    Thanks

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: check if worksheet is empty

    Possibly...
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,155

    Re: check if worksheet is empty

    Quote Originally Posted by goodluckboss View Post
    Hi there this is a super old thread but it solves my problem.

    Instead of deleting each empty worksheet, how do I make it total the number of empty worksheets in my workbook and output
    the data in a cell in worksheet named "Initial Analysis"

    Thanks
    Administrative Note:

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1