VBA using a cell reference on one sheet to go to another sheet

gberg

Board Regular
Joined
Jul 16, 2014
Messages
180
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that has tabs for every week of the year. The tab names go; 2022-01-02, 2022-01-09, 2022-01-16, etc.

I have a control sheet (Named "Changes")that has a cell to reference which week a macro taht will use this cell reference to pick the tab to go to

Cell G1 on the "Changes" tab will control which tab the macro should go to
1643498827620.png


I've tried this but it does not work and I'm at a loss so hoping someone could help

Dim ShtName As String
ShtName = Range(Text(G1, "yyyy-mm-dd"))
Sheets(ShtName).Select


Thanks,

Greg
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Changing to ShtName = Format(Range("G1").Value, "yyyy-mm-dd") should do the job

Bye
 
Upvote 0
Solution
Anthony,

Thats awesome! Thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

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