locked
Macro to Delete Tab RRS feed

  • Question

  • Hi Macro that opens and closes a series of workbooks and updates them the workbooks are getting a little big so I want to automatically delete some of the history tabs as they are updated. I have written a Macro that makes this happen :

    Sheets(“Option and macros”).select

     shdel = cells((9,7).value  ‘this being the generated tab name to delete

    Sheets(shdel).select

    ActiveWindow.SelectedSheets.Delete

    I then get an message from excel asking if I want to errantly delete the sheet, is there any way to automatically say yes Delete with the Macro as this runs through multiple workbooks over night ?

    Thanks

     

    Wednesday, April 20, 2011 9:50 AM

Answers

  • Hi Macro that opens and closes a series of workbooks and updates them the workbooks are getting a little big so I want to automatically delete some of the history tabs as they are updated. I have written a Macro that makes this happen :

    Sheets(“Option and macros”).select

     shdel = cells((9,7).value  ‘this being the generated tab name to delete

    Sheets(shdel).select

    ActiveWindow.SelectedSheets.Delete

    I then get an message from excel asking if I want to errantly delete the sheet, is there any way to automatically say yes Delete with the Macro as this runs through multiple workbooks over night ?

    Thanks

     


    If I undertand your question try:

    Application.DisplayAlerts = False
    ActiveWindow.SelectedSheets.Delete
    Application.DisplayAlerts = True


    Mauro Gamberini - Microsoft© MVP(Excel)
    http://www.maurogsc.eu/
    • Marked as answer by Harry Yuan Tuesday, April 26, 2011 2:39 AM
    Wednesday, April 20, 2011 3:52 PM