delete all sheets except "sheet1"

  • Is there a way for me to delete all sheets in a workbook by vba except sheet 1??? I know how to do it if they always keep the same name but the names of the other sheets are not always the same... I want like a select all except sheet 1... Any help is appreciated. Oh, Also, how can i make it bypass that message that says "all sheets will be deleted blah blah..."?? Thanks!



    Sheets(Array("Sheet1", "Sheet2")).Select
    ActiveWindow.SelectedSheets.Delete
    End Sub

  • Quote

    Originally posted by jjst34
    Oh, Also, how can i make it bypass that message that says "all sheets will be deleted blah blah..."?? Thanks!


    For this bit use Application.DisplayAlerts=False at the start of your code and remember to set to True at the end. Not sure about your main question though - sorry!

    <a href="http://www.mrexcel.com/relayforlife.shtml" target="new"><img src="http://www.myimgs.com/data/vonpookie/anne_relay.gif"></a>

  • Hi j,


    How about :

    HTH

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!