Selecting sheets (tabs) based on name and a cell value

tommyleinen

Board Regular
Joined
Aug 22, 2009
Messages
74
This is a bit beyond my reach. I'm needing to write some vba that I can assign to a macro button which will select the names of those sheets determined by a marker "X" running from a front page summary sheet which is basically as follows:

Tab Name (Col A7:Z Last row) is where the sheet names are listed
Select this tab? (Col Z7:Z Last row) is where the X's are listed


Leveon Bell X
Todd Gurley
Tom Brady X
Alex Smith X
Patrick Mahomes
Etc

So when I run the macro (press the button) the sheets named "Leveon Bell", "Tom Brady" and "Alex Smith" are selected ready for printing.

I hope one of the many capable people here can assist! thanks in advance :)
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
How about
Code:
Sub tommyleinen()
   Dim ary As Variant
   Dim Cl As Range
   Dim i As Long
   
   ReDim ary(1 To Application.CountIf(Range("Z:Z"), "x"))
   For Each Cl In Range("A7", Range("A" & Rows.count).End(xlUp))
      If Evaluate("isref('" & Cl.Value & "'!A1)") Then
         If LCase(Cl.Offset(, 25)) = "x" Then
            i = i + 1
            ary(i) = Cl.Value
         End If
      End If
   Next Cl
   Sheets(ary).Select
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,995
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top