![]() |
Delete Tabs
I need a function for a macro that allows me to delete all tabs that have a
$0.00 value in the cell C2? What code can I use to do this. I created a button, is there a better option (such as a way to generate it on open spreadsheet) ? |
Delete Tabs
Sub DeleteSheets()
for each sh in Worksheets if sh.range("C2").Value = 0 then Application.DisplayAlerts = False sh.Delete end if Next Application.DisplayAlerts = True end Sub Turn on the macro recorder and place a button from the forms toolbar on the sheet, then assign this macro to it. Turn off the macro recorder and you have your code. You would probably call it from the workbook_Open event http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy "dogpigfish" wrote in message ... I need a function for a macro that allows me to delete all tabs that have a $0.00 value in the cell C2? What code can I use to do this. I created a button, is there a better option (such as a way to generate it on open spreadsheet) ? |
All times are GMT +1. The time now is 07:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com