VBA Change sheet based on Drop down

blossomthe2nd

Active Member
Joined
Oct 11, 2010
Messages
450
Hi guys

Wonder if its possible to write a code that changes dependant on cell value ?

In cell G9 I have a drop down list , Red, Light green,Orange and blue. I wish to write a macro that runs dependant on what is selected from this drop down.

So for example, if I select Red it will go to Sheet1, Light green Sheet2 and so on ..


Is This possible and if so please help ?

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Assuming your drop-down list is in cell A1 of Sheet 1, the following should work for you. Obviously you can customize to meet your needs.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Sheet1.Range("A1"), Target) Is Nothing Then
        Select Case Target.Value
            Case "Red"
                Application.Goto Sheet2.Range("A1")
            Case "Light Green"
                Application.Goto Sheet3.Range("A1")
            Case "Orange"
                Application.Goto Sheet4.Range("A1")
            Case "Blue"
                Application.Goto Sheet5.Range("A1")
        End Select
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,550
Members
452,927
Latest member
rows and columns

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