New to Macros, probably a basic question

jimlemond

New Member
Joined
May 21, 2019
Messages
4
I have a spreadsheet with a main tab that has a variety of fields for the user to fill out. One of them is "Supervisor" (B5) and at the end I have a "Submit" button. Once I click the Submit button, I would like to be taken to the tab that corresponds with the name in B5. For instance, if B5 = "Jim" then go to the tab titled "Jim" would be the goal.

Cursory Google searches are giving me what looks to be way more complex options... but I am new to macros so everything seems a bit complex.

Any help would be much appreciated!!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
VBA Code:
Sub CommandButton1_Click()
Dim sString as string
sString = ActiveSheet.Range("B5").Value

Sheets(sString).Activate
End Sub

untested but let me know if that works
 
Upvote 0
How's this
VBA Code:
Sub GotoSheet()

    Sheets(ActiveSheet.Range("B5").Value).Activate

End Sub
 
Upvote 0
That would do the trick, thank you! Do either of you have any recommendations on how to start really learning this stuff, resources, books, etc.?
 
Upvote 0
That would do the trick, thank you! Do either of you have any recommendations on how to start really learning this stuff, resources, books, etc.?

try this post
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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