Hi Guys,
i need some help writing a rather simple code to check if a sheet exists and the delete it using the IF ERROR function (if its the easier way...).
I'm working on a workbook that is intended to be like a excel management report. It has several sheets with pivot tables filtering the database information in different ways. Because the workbook will be used by a large number of people, who often double-click on the pivots to see the details of some numbers in the report, I'd like to have amacro to save the file (in the same location) after modifications are done, but deleting the extra sheets created (Sheet 1, Sheet 2, etc...).
However, I don't know - and haven't found it in forums yet - the syntax for the IF ERROR function.
Is there anyway i can do that using this function?
What I thought of is something like this (i know this is not a proper code, it's just the main idea....)
for i = 1 to 10
if Sheets("Sheet"&i).Select Is error
then Next i
else Sheets("Sheet"&i).Select
ActiveWindow.SelectedSheets.Delete
end if
Next i
ActiveWorkbook.Save
Can this be done? Or is the function only used to check cell values?
Thanks!
Bookmarks