layered vbyesno

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
I've been struggling with trying to have a msgbox that is prompting other msgbox's. and a yes equaling two separate msgbox's.

if it were to look like a tree I would draw it to look like this:

New Yes/No;
____no=endsub
____1yes= New XXX Yes/no;
________________no=XXX (sheet not visible)
________________yes=XXX (sheet visible)
____2yes= New YYY Yes/No;
________________no=YYY (sheet not visible)
________________yes=YYY (sheet visible)

I've tried a few variations of the code I am working with but resulting with the second vbyesno not coming up at all.

Sheet14 is XXX
Sheet7 is YYY

Code:
Dim MsgTitle, MsgPrompt As String, Ret As Integer
    If Not Intersect(Target, Range("B12")) Is Nothing Then
    Application.ScreenUpdating = False
    MsgPrompt = "Is this New?"
    MsgTitle = "Possible Review Required"
    If Sheet1.[B12].Value <> "" Then
        Ret = MsgBox(MsgPrompt, vbYesNo, MsgTitle)
            If Ret = vbNo Then
            Sheet14.Visible = False
            Sheet7.Visible = False
        Else
            Ret = MsgBox("Is an XXX review required?", vbYesNo, "Possible XXX Review")
                If Ret = vbYes Then
                Sheet14.Visible = True
                Ret = MsgBox("Is a YYY review required?", vbYesNo, "Possible YYY Review")
                    If Ret = vbNo Then
                    Sheet7.Visible = False
                Else
                    Sheet7.Visible = True
                    End If
            Else
                Sheet14.Visible = False
End If
End If
End If
End If
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Is this what you want
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim MsgTitle, MsgPrompt As String, Ret As Integer
   If Not Intersect(Target, Range("B12")) Is Nothing Then
      Application.ScreenUpdating = False
      MsgPrompt = "Is this New?"
      MsgTitle = "Possible Review Required"
      If Target.Value <> "" Then
         If MsgBox(MsgPrompt, vbYesNo, MsgTitle) = vbNo Then
            Sheet14.Visible = False
            Sheet7.Visible = False
         Else
            If MsgBox("Is an XXX review required?", vbYesNo, "Possible XXX Review") = vbYes Then
               Sheet14.Visible = True
            Else
               Sheet14.Visible = False
            End If
            If MsgBox("Is a YYY review required?", vbYesNo, "Possible YYY Review") = vbYes Then
               Sheet7.Visible = True
            Else
               Sheet7.Visible = False
            End If
         End If
      End If
   End If
End Sub
 
Upvote 0
Hi try


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim MsgTitle As String, MsgPrompt As String
    Dim Ret As VbMsgBoxResult
    
    MsgPrompt = "Is this New?"
    MsgTitle = "Possible Review Required"
    
    If Not Intersect(Target, Me.Range("B12")) Is Nothing Then
    
    If Len(Target.Value) > 0 Then
        
        Sheet14.Visible = xlSheetVeryHidden
        Sheet7.Visible = xlSheetVeryHidden


            Ret = MsgBox(MsgPrompt, vbYesNo, MsgTitle)
            
            If Ret = vbYes Then
                Ret = MsgBox("Is an XXX review required?", vbYesNo, "Possible XXX Review")
                If Ret = vbYes Then Sheet14.Visible = xlSheetVisible
                Ret = MsgBox("Is a YYY review required?", vbYesNo, "Possible YYY Review")
                If Ret = vbYes Then Sheet7.Visible = xlSheetVisible
            End If
            
        End If
    End If
End Sub

Dave
 
Upvote 0

Forum statistics

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