Link to home
Start Free TrialLog in
Avatar of marku24
marku24Flag for United States of America

asked on

Multi selecting tabs using Excel VBA (except for starting tab)

I have a workbook that has many tabs for players.  All of the tabs i want to select and print at the same time all have "PDP" in them.  I am using the following code to select all of the tabs through VBA.  The code works great with the exception of; if another (non- PDP) tab is selected when the process begins, it adds that tab into the selection.  So if the Menu tab is selected when the process is triggered, it will add all the visible PDP tabs to the Menu selection.  This creates a problem when i am trying to print them.  Is there a way to not have it include the tab it is starting with?  

Sub CreatePlayerBinder()
    Dim sh As Worksheet

    For Each sh In Worksheets
       
            If sh.Name Like "PDP*" And sh.Visible = True Then
                With sh
                    .Select (False)
                End With
            End If

       
    Next sh

End Sub
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marku24

ASKER

That works like a charm.  thanks