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

tommyleinen

Board Regular
Joined
Aug 22, 2009
Messages
70
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:

Some videos you may like

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,225
Office Version
  1. 365
Platform
  1. Windows
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
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,225
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,123,177
Messages
5,600,160
Members
414,367
Latest member
dw970906

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
Top