AspiringAutomater
New Member
- Joined
- Jul 31, 2022
- Messages
- 4
- Office Version
- 365
- Platform
- Windows
Hello,
Long-time googler, first time poster here... I am trying to write brief code to allow me to select a cell, and then to select the worksheet whose name is equal to the cell value. Below is my attempted code and I get hung up on the "NewFrozenSheet = Range(c).Value" line. This code works if I hard code "c" to the cell reference (e.g., "A1"...rendering "c" irrelevant), but I would like it to remain a variable in the code. Appreciate whatever help anyone can offer, and thank you in advance!
Sub Monthly()
' Monthly Macro
Sheets("Consolidated Data").Select
Dim c As Range
Set c = Application.InputBox(prompt:="Select Last Sheet Ref to Freeze", Type:=8)
Dim NewFrozenSheet As String
NewFrozenSheet = Range(c).Value
Sheets(NewFrozenSheet).Activate
End Sub
Long-time googler, first time poster here... I am trying to write brief code to allow me to select a cell, and then to select the worksheet whose name is equal to the cell value. Below is my attempted code and I get hung up on the "NewFrozenSheet = Range(c).Value" line. This code works if I hard code "c" to the cell reference (e.g., "A1"...rendering "c" irrelevant), but I would like it to remain a variable in the code. Appreciate whatever help anyone can offer, and thank you in advance!
Sub Monthly()
' Monthly Macro
Sheets("Consolidated Data").Select
Dim c As Range
Set c = Application.InputBox(prompt:="Select Last Sheet Ref to Freeze", Type:=8)
Dim NewFrozenSheet As String
NewFrozenSheet = Range(c).Value
Sheets(NewFrozenSheet).Activate
End Sub