![]() |
Delete selected worksheets
Hello Everybody,
I have a macro created below that only delete selected worksheets in a workbook. But I keep recieve error massage . May I know where goes wrong ?? Can anyone help ?? Thanks in advance !!! Application.DisplayAlerts = False Sheets("Table 1").Delete Sheets("Table 2").Delete Sheets("Table 3").Delete Sheets("Table 4").Delete Sheets(Activesheets).Delete Application.DisplayAlerts = True |
Delete selected worksheets
Thre's nothing wrong with the code. What is the error message?
"Casey" wrote: Hello Everybody, I have a macro created below that only delete selected worksheets in a workbook. But I keep recieve error massage . May I know where goes wrong ?? Can anyone help ?? Thanks in advance !!! Application.DisplayAlerts = False Sheets("Table 1").Delete Sheets("Table 2").Delete Sheets("Table 3").Delete Sheets("Table 4").Delete Sheets(Activesheets).Delete Application.DisplayAlerts = True |
Delete selected worksheets
There is something wrong with the code
Sheets(Activesheets).Delete should be ActiveSheet.Delete And remember you cannot delete every sheet in a workbook. Mike "Mike H" wrote: Thre's nothing wrong with the code. What is the error message? "Casey" wrote: Hello Everybody, I have a macro created below that only delete selected worksheets in a workbook. But I keep recieve error massage . May I know where goes wrong ?? Can anyone help ?? Thanks in advance !!! Application.DisplayAlerts = False Sheets("Table 1").Delete Sheets("Table 2").Delete Sheets("Table 3").Delete Sheets("Table 4").Delete Sheets(Activesheets).Delete Application.DisplayAlerts = True |
Delete selected worksheets
Hi Mike,
Thanks for your reply & help. I do still recieve error message " Subscript out of range" There are many other more worksheets which i do not want to delete.. Casey "Mike H" wrote: There is something wrong with the code Sheets(Activesheets).Delete should be ActiveSheet.Delete And remember you cannot delete every sheet in a workbook. Mike "Mike H" wrote: Thre's nothing wrong with the code. What is the error message? "Casey" wrote: Hello Everybody, I have a macro created below that only delete selected worksheets in a workbook. But I keep recieve error massage . May I know where goes wrong ?? Can anyone help ?? Thanks in advance !!! Application.DisplayAlerts = False Sheets("Table 1").Delete Sheets("Table 2").Delete Sheets("Table 3").Delete Sheets("Table 4").Delete Sheets(Activesheets).Delete Application.DisplayAlerts = True |
Delete selected worksheets
Casey
Sheets(Activesheets).Delete Will give that error message use ActiveSheet.Delete Mike "Casey" wrote: Hi Mike, Thanks for your reply & help. I do still recieve error message " Subscript out of range" There are many other more worksheets which i do not want to delete.. Casey "Mike H" wrote: There is something wrong with the code Sheets(Activesheets).Delete should be ActiveSheet.Delete And remember you cannot delete every sheet in a workbook. Mike "Mike H" wrote: Thre's nothing wrong with the code. What is the error message? "Casey" wrote: Hello Everybody, I have a macro created below that only delete selected worksheets in a workbook. But I keep recieve error massage . May I know where goes wrong ?? Can anyone help ?? Thanks in advance !!! Application.DisplayAlerts = False Sheets("Table 1").Delete Sheets("Table 2").Delete Sheets("Table 3").Delete Sheets("Table 4").Delete Sheets(Activesheets).Delete Application.DisplayAlerts = True |
All times are GMT +1. The time now is 01:54 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com