Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locating if a Sheet is present in a workbook
Two Part Question:
I am looking for code that will locate if a sheet by a specific name is in the workbook, and then delete it if it is. What is the easiest way to do this? (I am not sure if an "IF" statement is the best way to go or not). Secondly, is there a way to keep the warning pop-up from occurring when trying to delete said sheet? Thanks! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locating if a Sheet is present in a workbook
for each ws in worksheets
application.displayalerts =false if ws.name="Bad Name" then ws.delete application.displayalerts=true next ws -- Don Guillett Microsoft MVP Excel SalesAid Software "Shane" wrote in message ... Two Part Question: I am looking for code that will locate if a sheet by a specific name is in the workbook, and then delete it if it is. What is the easiest way to do this? (I am not sure if an "IF" statement is the best way to go or not). Secondly, is there a way to keep the warning pop-up from occurring when trying to delete said sheet? Thanks! |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locating if a Sheet is present in a workbook
on error resume next
application.displayalerts = false sheets("Sheet1").Delete application.displayalerts = true on error goto 0 -- HTH... Jim Thomlinson "Shane" wrote: Two Part Question: I am looking for code that will locate if a sheet by a specific name is in the workbook, and then delete it if it is. What is the easiest way to do this? (I am not sure if an "IF" statement is the best way to go or not). Secondly, is there a way to keep the warning pop-up from occurring when trying to delete said sheet? Thanks! |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Locating if a Sheet is present in a workbook
Thank you so much... works like a charm!!
"Don Guillett" wrote: for each ws in worksheets application.displayalerts =false if ws.name="Bad Name" then ws.delete application.displayalerts=true next ws -- Don Guillett Microsoft MVP Excel SalesAid Software "Shane" wrote in message ... Two Part Question: I am looking for code that will locate if a sheet by a specific name is in the workbook, and then delete it if it is. What is the easiest way to do this? (I am not sure if an "IF" statement is the best way to go or not). Secondly, is there a way to keep the warning pop-up from occurring when trying to delete said sheet? Thanks! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Locating a Worksheet from another Workbook | Excel Worksheet Functions | |||
locating cell info from one sheet | Excel Worksheet Functions | |||
List all sheets present in Workbook | Excel Worksheet Functions | |||
How can I count number of sheets present in a workbook? | Excel Discussion (Misc queries) | |||
LOCATING A CHART SAVED IN A WORKBOOK | Excel Discussion (Misc queries) |