Select a worksheet based on excel drop down

levans_1986

New Member
Joined
Aug 9, 2017
Messages
13
Hello

I am creating a questionnaire which comprises of three excel worksheets. On the first worksheet one of the questions has a yes/no answer in a dropdown. I want to automatically select a worksheet depending on the answer to the question

For example:
If someone selects yes they are automatically taken to worksheet 2(PartA). If they select no they are automatcially taken to worksheet 3(PartB).

I have recorded two macros, Mac_PartA which takes you to sheet 2 and Mac_PartB which takes you to sheet 3. I've tried to use some vba code but I'm not overly familar with it and I am getting a compile error. the code I have is saved in the workbook rather than the sheet

the code is
Private Sub Workbook_SheetChange(ByVal Target As Range)
If Not Intersect(Target, Range("P2")) Is Nothing Then Select Case Range("P2")

Select Case Range("P2")

Case "Yes": Mac_PartA
Case "No": Mac_PartB
End Select
End If
End Sub

Can anyone help?

Many thanks in advance :)

Laura
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,216,084
Messages
6,128,730
Members
449,465
Latest member
TAKLAM

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