Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Looping through selected worksheets and delete a range (e.g., A2:D15) | Excel Programming | |||
Delete rows at the same time from selected worksheets | Excel Programming | |||
Delete Selected Records | Excel Programming | |||
Delete Selected Records | Excel Programming | |||
delete every nth row in selected range | Excel Discussion (Misc queries) |