Select Sheets from Cell Value

scottclayton

New Member
Joined
Apr 20, 2014
Messages
8
Hello Excel Folks,

I'm trying to tell Excel to select sheets that are named in a cell—e.g. cell A1's value is:
"Sheet1", "Sheet2", "Sheet4"

I want Excel to do the equivalent of me clicking Sheet1 and holding ctrl while clicking Sheet2 and Sheet4. I can't do something as simple as



Sub SelectingSheets()
'
' SelectingSheets Macro
'

'
Sheets(Array(Range("A1").Value)).Select
End Sub



because then I get a "subscript out of range" error.

Anyone have any ideas? Thanks in advance. I'm probably missing something super obvious.

I'm ultimately trying to print only certain sheets. In my real-world example I'll have at least 35 sheets in my workbook, but only a handful might need to be printed, but that handful will be changing all the time—(and the cell will update as needed, which is easy enough).
 
You're missing a few things there...

Code:
Sheets(Split(Replace(Replace(Range("A1").Value, """", ""), " ", ""), ",")).Select
 
Upvote 0
You're welcome, thanks for the feedback!
 
Upvote 0

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