Open up different tabs based on Macros Combo Box

Mariyka1

New Member
Joined
Nov 1, 2016
Messages
44
HI!
I have two tabs - "RM1_Revenue" and "RM2_Revenue".

I also have a drop down with two selections - RM1 and RM2 - I want to be able to select RM1 and have the "RM1_Revenue" tab open up, and vice versa. I've tried multiple ways and keep getting an error.
My combo box is location in the "control" tab cell "B17"

Below are the codes I've tried. Any help is greatly appreciated!



Sub DropDown499_Change()

If Not Intersect(Target, range("B17")) Is Nothing Then
Select Case range("B17")
Case "RM1": Macro1
Case "RM2": Macro2

End Select
End If
End Sub

----------------------------------------------------------------------------


Sub DropDown500_Change()
If Target.Value = "RM 1" Then
Sheets("RM1_Revenue").Visible = True
Sheets("RM2_Revenue").Visible = False
ElseIf Target.Value = "RM 2" Then
Sheets("RM2_Revenue").Visible = True
Sheets("RM1_Revenue").Visible = False
End If
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Code:
Sub DropDown500_Change()
   With Range("B17")
      Sheets("RM1_Revenue").Visible = .Value = 1
      Sheets("RM2_Revenue").Visible = .Value = 2
   End With
   If Sheets("RM1_Revenue").Visible Then Sheets("Pcode").Select
   If Sheets("RM2_Revenue").Visible Then Sheets("Check").Select
End Sub
This assumes that RM1 is the first value in the dropdown & RM2 is the second
 
Upvote 0

Forum statistics

Threads
1,224,837
Messages
6,181,255
Members
453,028
Latest member
letswriteafairytale

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