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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,171
Members
453,021
Latest member
Justyna P

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