+ Reply to Thread
Results 1 to 5 of 5

Delete Sheets

  1. #1
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141

    Delete Sheets

    Hi

    Does anyone have any suggestions for deleting an entire sheet in a workbook if Cell A1 in the Sheet is blank?

    Thanks

  2. #2
    Chip Pearson
    Guest

    Re: Delete Sheets

    Try

    If Range("A1").Value = "" Then
    Application.DisplayAlerts = False
    Worksheets("Sheet1").Delete
    Application.DisplayAlerts = True
    End If


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "STEVEB" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Hi
    >
    > Does anyone have any suggestions for deleting an entire sheet
    > in a
    > workbook if Cell A1 in the Sheet is blank?
    >
    > Thanks
    >
    >
    > --
    > STEVEB
    > ------------------------------------------------------------------------
    > STEVEB's Profile:
    > http://www.excelforum.com/member.php...fo&userid=1872
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=506797
    >




  3. #3
    Glen
    Guest

    Re: Delete Sheets

    Sub DelSheet()
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim a As Variant

    Set wb = ActiveWorkbook
    Set ws = wb.Worksheets("sheet1")
    a = Range("A1").Value
    'Put this in a for loop to change wb or ws as necessary
    If a = "" Then
    ws.Delete
    Else
    Set ws = wb.Worksheets("sheet2")
    End If

    End Sub


  4. #4
    Bruno Campanini
    Guest

    Re: Delete Sheets

    "STEVEB" <[email protected]> wrote in
    message news:[email protected]...

    One more way:
    ---------------------------------
    Sub Button14_Click()
    Application.DisplayAlerts = False
    If IsEmpty([Sheet7!A1]) Then
    Sheets("Sheet7").Delete
    End If

    End Sub
    ------------------------------

    Bruno



  5. #5
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    Thanks everyone,

    Everything worked great! I appreciate your help!

+ Reply to 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