Goto argument

Dazlancs

New Member
Joined
Sep 10, 2011
Messages
28
Hi,

I am new to the site and reasonably adequate on the very basics of excel (self taught from playing about0 but really need some help with the VB code to do the following:

If q4 = "yes" then goto q5
if q4 = "no" then goto q7....

Below is the code i currently have:

Code:
 q4 = InputBox("Q4: Is there a conference call with the appropriate CSOC??", "CSOCConfcall", "Yes/No")
Worksheets("Response").Cells(Range("CSOCConfcall").Row, Range("CSOCConfcall").Column).Value = q4
If q4 = "no" Then
Else: If q4 = "yes" Then q5 = InputBox("Q5: What are the dial in details?", "confcalldetails", "")
Worksheets("Response").Cells(Range("confcalldetails").Row, Range("confcalldetails").Column).Value = q5
If q4 = "yes" Then q6 = InputBox("Q6: What is the participants PIN?", "partpin", "")
Worksheets("Response").Cells(Range("partpin").Row, Range("partpin").Column).Value = q6
If q4 = "yes" Then q7 = InputBox("Q7: Are the SRM's aware on the group IM??", "SRMonIMAware", "Yes/No")
Worksheets("Response").Cells(Range("SRMonIMAware").Row, Range("SRMonIMAware").Column).Value = q7

This works fine to answer all questions but i need it to skip question 5 and question 6 if question 4 is answered with a no.

I am really stuck on this and need assistance please :confused:
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Code:
    q4 = InputBox("Q4: Is there a conference call with the appropriate CSOC??", "CSOCConfcall", "Yes/No")
    Worksheets("Response").Cells(Range("CSOCConfcall").Row, Range("CSOCConfcall").Column).Value = q4
    If q4 = "Yes" Then
        q5 = InputBox("Q5: What are the dial in details?", "confcalldetails", "")
        Worksheets("Response").Cells(Range("confcalldetails").Row, Range("confcalldetails").Column).Value = q5
        q6 = InputBox("Q6: What is the participants PIN?", "partpin", "")
        Worksheets("Response").Cells(Range("partpin").Row, Range("partpin").Column).Value = q6
    Else
        q7 = InputBox("Q7: Are the SRM's aware on the group IM??", "SRMonIMAware", "Yes/No")
        Worksheets("Response").Cells(Range("SRMonIMAware").Row, Range("SRMonIMAware").Column).Value = q7
    End If
 
Upvote 0
Try like this

Code:
q4 = InputBox("Q4: Is there a conference call with the appropriate CSOC??", "CSOCConfcall", "Yes/No")
Worksheets("Response").Cells(Range("CSOCConfcall").Row, Range("CSOCConfcall").Column).Value = q4
If q4 = "yes" Then
    q5 = InputBox("Q5: What are the dial in details?", "confcalldetails", "")
    Worksheets("Response").Cells(Range("confcalldetails").Row, Range("confcalldetails").Column).Value = q5
    q6 = InputBox("Q6: What is the participants PIN?", "partpin", "")
    Worksheets("Response").Cells(Range("partpin").Row, Range("partpin").Column).Value = q6
End If
q7 = InputBox("Q7: Are the SRM's aware on the group IM??", "SRMonIMAware", "Yes/No")
Worksheets("Response").Cells(Range("SRMonIMAware").Row, Range("SRMonIMAware").Column).Value = q7
 
Upvote 0
WOW :eeek: I didn't expect a reponse so fast.

Many thanks to both of you - my issue is resolved and works perfectly.

I am sure i will be back for more questions to be answered..... i have used this site dozens of time before but via google - figured it was time i took part in officially being a geek :)
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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