+ Reply to Thread
Results 1 to 5 of 5

delete all sheet tabs apart form the first 3

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134

    delete all sheet tabs apart form the first 3

    Just created 1800 sheets by not closing a loop, just wondering if anyone has a quick solution to delete all of these apart from the first three

    George

  2. #2
    Forum Expert
    Join Date
    09-09-2005
    Location
    England
    MS-Off Ver
    2007
    Posts
    1,500
    Well if you go to the 4th sheet tab click on it and hold down shift, then press the last sheet button, then click on the last sheet, all the sheets are highlighted. Then right click and select delete.

    Regards

    Dav

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Next time close the workbook without saving

    For a VBA methoid

    Option Explicit
    
    Sub deleteShts()
        Dim sht    As Worksheet
        With Application
            .DisplayAlerts = False
            .ScreenUpdating = False
            For Each sht In ThisWorkbook.Worksheets
                If sht.Index > 3 Then sht.Delete
            Next sht
            .DisplayAlerts = True
            .ScreenUpdating = True
        End With
    End Sub
    Last edited by royUK; 11-05-2008 at 04:52 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Thank you that worked great saved about an hour of deleting woorksheets

    George

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Glad we helped.

    Can you mark the thread solved?

    Also, please don't use unnecessary words in titles like "odd question"

+ 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