+ Reply to Thread
Results 1 to 3 of 3

Delete Worksheets Based On Name

Hybrid View

Fermented Reptile Delete Worksheets Based On... 01-18-2012, 10:29 AM
Richard Buttrey Re: Delete Worksheets Based... 01-18-2012, 10:47 AM
Fermented Reptile Re: Delete Worksheets Based... 01-18-2012, 11:02 AM
  1. #1
    Registered User
    Join Date
    12-30-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010
    Posts
    82

    Delete Worksheets Based On Name

    Hi all,

    Hopefully this is a fairly simple one. I have a workbook with a huge amount of sheets. A number of these contain the word 'Urgent' - Urgent(2), Urgent(3), etc - and I wish to delete any sheet that contains this word. Rather than go through and delete each individually, can anyone suggest a piece of code that might do this in one go?

    TIA,

    Fermented R
    Last edited by Fermented Reptile; 01-18-2012 at 11:03 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Delete Worksheets Based On Name

    Hi,
    One way
    Sub DeleteUrgentSheets()
        Dim x As Long
        Application.DisplayAlerts = False
        For x = 1 To Sheets.Count - 1
            If InStr(LCase(Sheets(x).Name), "urgent") Then
                Sheets(x).Delete
            End If
        Next x
    End Sub
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    12-30-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Delete Worksheets Based On Name

    Hi Richard,

    That looks like it's working! Many thanks,

    Fermented R

+ 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