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) ?
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) ?
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" <dogpigfish@discussions.microsoft.com> wrote in message
news:65ACE759-8A18-493F-8CC6-240795F15402@microsoft.com...
> 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) ?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks