Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Exclusion dictionary for excel 2003 | Excel Discussion (Misc queries) | |||
Validation from Exclusion list | Excel Discussion (Misc queries) | |||
Find and Replace exclusion | Excel Discussion (Misc queries) | |||
How do we make Inclusion-Exclusion Principles on Excel? | Excel Worksheet Functions | |||
MATCH function, exclusion question | Excel Discussion (Misc queries) |