Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default exclusion list in code

I want to all delete sheets from my workbook except for ones that i specify.
This is what I had in mind. If I wanted to exclude say Sheet1, Sheet4, and
Sheet7, how can I incorporate this into the following code?
Can I call a function?

Bruce

Dim wkSht as WorkSheet
For each wkSht in WorkSheets

if wkSht < 'something' then

wkSht.Delete

next wkSht
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default exclusion list in code

else
wkSht.Delete


should be

Case Else
wksSht.Delete


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"AA2e72E" wrote in message
...
Dim wkSht as WorkSheet
For each wkSht in ActiveWorkbook.WorkSheets
select case wkSht.Name
case "keep1", "keep2", "keep3"
' do nothing
else
wkSht.Delete
end select
next wkSht

You must keep at least one sheet i.e. a workbook must have at
least one sheet.

"Bruce" wrote:

I want to all delete sheets from my workbook except for ones
that i specify.
This is what I had in mind. If I wanted to exclude say Sheet1,
Sheet4, and
Sheet7, how can I incorporate this into the following code?
Can I call a function?

Bruce

Dim wkSht as WorkSheet
For each wkSht in WorkSheets

if wkSht < 'something' then

wkSht.Delete

next wkSht



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default exclusion list in code

I bet that Chip was correcting the "Case Else" portion--not the wkSht portion.



Chip Pearson wrote:

else
wkSht.Delete


should be

Case Else
wksSht.Delete

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"AA2e72E" wrote in message
...
Dim wkSht as WorkSheet
For each wkSht in ActiveWorkbook.WorkSheets
select case wkSht.Name
case "keep1", "keep2", "keep3"
' do nothing
else
wkSht.Delete
end select
next wkSht

You must keep at least one sheet i.e. a workbook must have at
least one sheet.

"Bruce" wrote:

I want to all delete sheets from my workbook except for ones
that i specify.
This is what I had in mind. If I wanted to exclude say Sheet1,
Sheet4, and
Sheet7, how can I incorporate this into the following code?
Can I call a function?

Bruce

Dim wkSht as WorkSheet
For each wkSht in WorkSheets

if wkSht < 'something' then

wkSht.Delete

next wkSht


--

Dave Peterson

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
Exclusion dictionary for excel 2003 Raul Queiroga Excel Discussion (Misc queries) 1 December 14th 09 05:32 PM
Validation from Exclusion list Jim Excel Discussion (Misc queries) 4 June 16th 09 03:20 PM
Find and Replace exclusion Jenn Excel Discussion (Misc queries) 8 April 6th 09 08:45 PM
How do we make Inclusion-Exclusion Principles on Excel? wewetts Excel Worksheet Functions 0 June 6th 07 01:44 PM
MATCH function, exclusion question Paul Lautman Excel Discussion (Misc queries) 4 July 21st 06 04:53 AM


All times are GMT +1. The time now is 03:51 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"