Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
I need 3 consecutive message boxes to show if conditions are met
and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
If date1 Date Then
MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
Thanks, Bob,
I appreciate it! "Bob Phillips" wrote: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
Bob,
I thought I had it all but I am still having trouble with the vbNo. Where do you position the vbNo 'do nothing ? Thanks, "Bob Phillips" wrote: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
Myriam,
As it is the vbNo does nothing already. YOu are not referring to the first message are you? -- HTH RP "Myriam" wrote in message ... Bob, I thought I had it all but I am still having trouble with the vbNo. Where do you position the vbNo 'do nothing ? Thanks, "Bob Phillips" wrote: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
Yes, Bob, I still need more help.
See below: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response =vbNo 'do nothing ElseIf Response = vbYes Then MsgBox "Do Action",vbYesNoCancel If Response=vbNo 'do nothing ElseIf Response =vbYes Save....etc.....do the specified action End If End If End If ---------------------- The 1st vbNo 'do nothing works fine. It is the second response that still preforms the actions as if the response had been a vbYes. In other words vbYes and vb No perform the action that should only be done if vbYes is pressed. Thanks! --------------------- "Bob Phillips" wrote: Myriam, As it is the vbNo does nothing already. YOu are not referring to the first message are you? -- HTH RP "Myriam" wrote in message ... Bob, I thought I had it all but I am still having trouble with the vbNo. Where do you position the vbNo 'do nothing ? Thanks, "Bob Phillips" wrote: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Nested Ifs
Myriam,
How is this? If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox(" Are you sure?", vbYesNoCancel) If Response = vbNo Then 'do nothing ElseIf Response = vbYes Then Response = MsgBox("Do Action", vbYesNoCancel) If Response = vbNo Then 'do nothing ElseIf Response = vbYes Then Save....etc.....do the specified action End If End If End If -- HTH RP "Myriam" wrote in message ... Yes, Bob, I still need more help. See below: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response =vbNo 'do nothing ElseIf Response = vbYes Then MsgBox "Do Action",vbYesNoCancel If Response=vbNo 'do nothing ElseIf Response =vbYes Save....etc.....do the specified action End If End If End If ---------------------- The 1st vbNo 'do nothing works fine. It is the second response that still preforms the actions as if the response had been a vbYes. In other words vbYes and vb No perform the action that should only be done if vbYes is pressed. Thanks! --------------------- "Bob Phillips" wrote: Myriam, As it is the vbNo does nothing already. YOu are not referring to the first message are you? -- HTH RP "Myriam" wrote in message ... Bob, I thought I had it all but I am still having trouble with the vbNo. Where do you position the vbNo 'do nothing ? Thanks, "Bob Phillips" wrote: If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then Response = MsgBox (" Are you sure?",vbYesNoCancel) If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel End If End If Indenting helps to see the flow. -- HTH RP "Myriam" wrote in message ... I need 3 consecutive message boxes to show if conditions are met and User responds yes. I can make 2 work but I can't get the 3rd IF to work. e.g., This portion works fine: -------------------------------- If date1 Date Then MsgBox "Cancel Action", vbOKOnly ElseIf date1 <= Date Then MsgBox " Are you sure?",vbYesNoCancel -------------------- 'This last one is the one I need help with: If Response = vbYes Then MsgBox "Do Action",vbYesNoCancel ------------------------------ Thanks in advance, you are all great! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
nested ifs | Excel Discussion (Misc queries) | |||
Nested IFs | Excel Worksheet Functions | |||
nested if based on nested if in seperate sheet. how? | Excel Worksheet Functions | |||
Nested if | Excel Worksheet Functions | |||
What is quicker? Nested or non nested ifs | Excel Programming |