VBA - Button to go a specific sheet depending on dropdown list

akshay0880

New Member
Joined
Jul 11, 2021
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hey Guys, I'm quite a newbie on this. So, I need button when I click, it will go a specific worksheet (within same workbook) depending on a dropdown list.
example: dropdown list say 'Freq Change'
when I click the button, it goes to the 'Freq Change' sheet

I will have multiple sheets like this and all the sheets will be hidden and I only want the selected sheets (in this case Freq Change) to unhide.
Sheet 1 (named Start) will be unhidden at all times and on which I will have the button + Dropdown list

Anyone can help me out please? ☺️
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,639
You actually don't need a button. Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your "Start" sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the range (in red) to match the cell that contains the drop down list. Close the code window to return to your sheet. Make a selection in the drop down list.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
    With Sheets(Target.Value)
        .Visible = True
        .Activate
    End With
End Sub
 

akshay0880

New Member
Joined
Jul 11, 2021
Messages
8
Office Version
  1. 365
Platform
  1. Windows
You actually don't need a button. Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your "Start" sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Change the range (in red) to match the cell that contains the drop down list. Close the code window to return to your sheet. Make a selection in the drop down list.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
    With Sheets(Target.Value)
        .Visible = True
        .Activate
    End With
End Sub
Hi, Thank you for the response.
However, I still need a button because I need to enter more things on the 'Start' sheet before I want to go to the other worksheets.
Basically, I will fill out some data including the dropdown list and when I am done, then I'd hit the "button" and that's when I want it to take me to the correct worksheets.
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
10,639
Place this macro in a regular code module (not the worksheet code module as the previous macro) and assign it to your button.
Rich (BB code):
Sub ActivateSheet()
    With Sheets(Range("A1").Value)
        .Visible = True
        .Activate
    End With
End Sub
 

Forum statistics

Threads
1,147,498
Messages
5,741,504
Members
423,663
Latest member
kaveh87rsh

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
Top