Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting tabs in Excel
Hi -
I have an Excel workbook with several tabs titled with #'s (Ex: 100, 205, 303, 544, etc.) Is it possible to create a macro that will delete all the tabs except for a certain group? For example, I would want to keep tab 205 and 303 but delete all the other ones. Thanks Stephen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting tabs in Excel
for each ws in worksheets
if ws.name<"nameone" and ws.name<"name2" then ws.delete next -- Don Guillett SalesAid Software wrote in message oups.com... Hi - I have an Excel workbook with several tabs titled with #'s (Ex: 100, 205, 303, 544, etc.) Is it possible to create a macro that will delete all the tabs except for a certain group? For example, I would want to keep tab 205 and 303 but delete all the other ones. Thanks Stephen |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Deleting tabs in Excel
You may want to look at the "select case" example in VBA's Help:
Dim wks As Worksheet For Each wks In ActiveWorkbook.Worksheets Select Case LCase(wks.Name) Case Is = "205", "303", "keepthis" 'do nothing Case Else Application.DisplayAlerts = False wks.Delete Application.DisplayAlerts = True End Select Next wks You always have to have at least one visible sheet in the workbook--this code didn't do any checking for that. wrote: Hi - I have an Excel workbook with several tabs titled with #'s (Ex: 100, 205, 303, 544, etc.) Is it possible to create a macro that will delete all the tabs except for a certain group? For example, I would want to keep tab 205 and 303 but delete all the other ones. Thanks Stephen -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
tabs are missing even though 'tools-options-view-sheet tabs' ok? | Excel Worksheet Functions | |||
Can i set up tabs within tabs on Excel? | Excel Worksheet Functions | |||
Deleting some tabs from sum formula | Excel Worksheet Functions | |||
Deleting multiple Chart Tabs/sheets | Excel Programming | |||
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content | Excel Programming |