Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through selected worksheets and delete a range (e.g., A2:D15) [email protected] Excel Programming 1 October 10th 07 01:41 AM
Delete rows at the same time from selected worksheets Filo Excel Programming 3 May 5th 07 02:41 PM
Delete Selected Records Ian B Excel Programming 1 March 28th 07 07:09 PM
Delete Selected Records Vergel Adriano Excel Programming 0 March 28th 07 01:20 AM
delete every nth row in selected range cwinters Excel Discussion (Misc queries) 1 July 6th 05 08:17 PM


All times are GMT +1. The time now is 10:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"