Thread: Delete Tabs
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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) ?