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?
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,691
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
 

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
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
 

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
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.
 

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
16,691
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.
 

Forum statistics

Threads
1,084,936
Messages
5,380,677
Members
401,693
Latest member
dwoychowski

Some videos you may like

This Week's Hot Topics

Top