Refer to sheet by name stored in cell - Amend code

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi,

I have the below coding which works fine but instead of referring to the sheet named "Cordis", I would like it to get the sheet name from cell A12 (which has "Cordis" typed in it).

Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("Monthly Data").Select
CleanUp
Sheets("Cordis").Select
ClientNarrative
Sheets("Dashboard").Select
Application.ScreenUpdating = True
CommandButton1.Enabled = False
End Sub

I have tried

Code:
Sheets(Range("A12")).Select
ClientNarrative

And

Code:
Call Sheets(Range("A12")).Select
ClientNarrative

But neither seem to work. Can anyone see how I can get this working please? Thank you
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
See the modification to your code in bold red font below. Note A12 should contain "Cordis" w/o the quote marks.
Hi,

I have the below coding which works fine but instead of referring to the sheet named "Cordis", I would like it to get the sheet name from cell A12 (which has "Cordis" typed in it).

Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("Monthly Data").Select
CleanUp
[B][COLOR=#ff0000]Sheets(Range("A12").Value).Select[/COLOR][/B]
ClientNarrative
Sheets("Dashboard").Select
Application.ScreenUpdating = True
CommandButton1.Enabled = False
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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