messagebox to prompt another messagebox

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
I am having a difficult time figuring out how to have a yes/no messagebox selection open another yes/no messagebox. Is this not possible and I need to use a userform?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Code:
Sub OneMsgBxTrggersAnother()
Dim ans As Long
ans = MsgBox("This is the first message box, click Yes to get a second message box", vbYesNo)
If ans = vbYes Then MsgBox "This is the second message box"
End Sub
 
Upvote 0
so this has to be in it's own sub? my original msgbox was in a Private Sub Worksheet_Change(ByVal Target As Range).
I am just trying to have the yes selection generate an additional msgbox with another question that would result in different actions.

Code:
 Dim MsgTitle, MsgPrompt As String, Ret As Integer
 If Not Intersect(Target, Range("B12")) Is Nothing Then
    Application.ScreenUpdating = False
    MsgPrompt = "Is this either a New Task, or a Technical Change?"
    MsgTitle = "Possible Engineering Review Required"
    If Sheet1.[B12].Value <> "" Then
        Ret = MsgBox(MsgPrompt, vbYesNo, MsgTitle)
        If Ret = vbNo Then
            Sheet8.CheckBox1.Value = True
            Sheet8.CheckBox2.Value = True
            MsgBox "verify (Review Not Required) Boxes are checked on lines 1 and 2 of SA20045 form"
            Sheet7.Visible = xlSheetVeryHidden
        Else
            MsgBox "Ensure SA20044 Form is included with deliverable"
            Sheet8.CheckBox1.Value = False
            Sheet8.CheckBox2.Value = False
            Sheet7.Visible = True
            End If
    End If
End If
 
Upvote 0
I just realized I don't think I made myself very clear. I want the first yes/no message box to have those selections trigger other yes/no msgbox.
 
Upvote 0
No, it doesn't have to be in a separate sub - just trying to show you the logic required which you can adapt to your event code. The 2nd box can be Yes/No, too, if that's what you want.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
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