LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Deleting Worksheets

I have a workbook that contains 4 worksheets:
EcomSec, Programs, EcomData, & Profiles.

I do a lot of data manipulation between the EcomSec & EcomData ws and paste
that data into the Profiles ws.
After this completes I want to delete all but the Profiles ws. It was
working until one of the worksheets was moved.

Here's the code.
Sub test()
Application.DisplayAlerts = False
For Each wks In Worksheets
If InStr("Programs", wks.Name) 0 Then wks.Delete
If InStr("EcomSec", wks.Name) 0 Then wks.Delete
If InStr("EcomData", wks.Name) 0 Then wks.Delete
Next wks

End Sub

I know there's got to be a way to do this but not sure how.

Thanks for your help.
 
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
Deleting Worksheets Jeff Excel Programming 1 July 18th 07 04:55 AM
Deleting worksheets David Excel Discussion (Misc queries) 2 January 19th 07 08:19 PM
Deleting Worksheets Chip Pearson Excel Programming 0 December 7th 06 06:45 PM
Deleting WorkSheets MANY Corey Excel Programming 4 July 4th 06 01:54 AM
Deleting Worksheets in VBA Knut Dahl Excel Programming 4 May 23rd 05 07:22 PM


All times are GMT +1. The time now is 07:08 AM.

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"