View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default 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