Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
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
tabs are missing even though 'tools-options-view-sheet tabs' ok? rgranell Excel Worksheet Functions 3 August 16th 08 04:25 PM
Can i set up tabs within tabs on Excel? Gizelle Excel Worksheet Functions 5 October 30th 06 12:52 PM
Deleting some tabs from sum formula DGM Excel Worksheet Functions 1 January 21st 06 08:52 PM
Deleting multiple Chart Tabs/sheets CLR Excel Programming 13 March 6th 05 03:58 AM
Deleting Hyphens or Dashes from multiple cells without deleting the remaining content rmaloy Excel Programming 5 February 9th 04 01:59 AM


All times are GMT +1. The time now is 03:13 AM.

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

About Us

"It's about Microsoft Excel"