+ Reply to Thread
Results 1 to 9 of 9

Deleting Worksheets in a table

Hybrid View

iamrickdeans Deleting Worksheets in a table 01-29-2013, 01:50 PM
AB33 Re: Deleting Worksheets in a... 01-29-2013, 01:58 PM
iamrickdeans Re: Deleting Worksheets in a... 01-29-2013, 02:18 PM
AB33 Re: Deleting Worksheets in a... 01-29-2013, 02:29 PM
iamrickdeans Re: Deleting Worksheets in a... 01-29-2013, 02:37 PM
AB33 Re: Deleting Worksheets in a... 01-29-2013, 02:51 PM
iamrickdeans Re: Deleting Worksheets in a... 01-29-2013, 02:59 PM
AB33 Re: Deleting Worksheets in a... 01-29-2013, 03:01 PM
iamrickdeans Re: Deleting Worksheets in a... 01-30-2013, 07:27 AM
  1. #1
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Deleting Worksheets in a table

    Sub deleteme()
        Dim sh As Worksheet
        Application.ScreenUpdating = 0
        Application.DisplayAlerts = 0
        For Each sh In Worksheets
            If sh.Name <> "DATA TO DELETE" And sh.Name <> "PURPLE" Then sh.Delete
        Next sh
          Application.ScreenUpdating = 1
         Application.DisplayAlerts = 1
    End Sub

  2. #2
    Registered User
    Join Date
    01-21-2013
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Deleting Worksheets in a table

    Thank you, for the reply however when I ran this against my sample file it worked but the main data that I am using differs massively from the sample (not about colours at all) so this code won't fit.

    I understand that you have added <> "Data to Delete" so that it doesn't delete the worksheet that the data is contained in but in my live workbook there are about 70 worksheets I need the Macro to delete only items contained within the defined table.

    I tried modifying your code to achieve this but I got back to the same issue that it deleted everything.

    Really appreciate your help though, any further ideas?

    Regards

    R

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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