Avatar of Bright01
Bright01Flag for United States of America

asked on 

Macro Adjustment to prevent complete deletion

EE Pros,

I have a great WS that a number of EE Pros have helped me out with.  It now works incredibly well.  However, I can see a potential problem as I add additional Tabs or integrate this WS into a larger WB with existing Tabs.

The macro for deleting all tabs except the original uses a bit of code that may delete ALL TABs other then the original.  So instead of deleting only the "spawned" tabs (i.e. Priority_Map1, Priority_Map(2), etc. etc., I think it would auto. delete ALL TABS except the Priority_Map Tab.  Can you add a little code that will only delete tabs that have "Priority_Map" with an extension?

Thank you,

B.

Here's the code:

Sub Deletesheet()
Application.EnableEvents = False
Dim sht As Worksheet
For Each sht In ActiveWorkbook.Worksheets
Application.DisplayAlerts = False
Select Case sht.Name
        Case "Priority_Map"
            'Do Nothing
        Case Else
            sht.Delete
    End Select
Next
Application.DisplayAlerts = True
  Application.EnableEvents = True
End Sub
Microsoft Excel

Avatar of undefined
Last Comment
Bright01
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Bright01
Bright01
Flag of United States of America image

ASKER

Just what was ordered!  Much thanks,

B.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo