Message Box with 3 options

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
HI Everyone,

I need the code for a message box that gives the person 3 options

when run the message box needs to say "You have not Submited Data Yet" new line " What would you like to do?

Then if possible give the options of


"Cancel" "Submit & Continue" "Continue"

if cancel just come out,
if Continue just carry on
if submit call "Submit" then carry on

please help if you can

Thanks

Tony
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You need a userform for that..
 
Upvote 0
As @pcc has suggested, a userform would be best. However, see if this macro does what you want.
Code:
Option Compare Text
Sub GetResponse()
    Application.ScreenUpdating = False
    Dim response As String
    If MsgBox("You have not Submited Data Yet" & Chr(10) & "Would you like to continue?", vbYesNo) = vbYes Then
        response = InputBox("Please enter 'Cancel', 'Submit & Continue' or 'Continue'.", "Enter 'Cancel', 'Submit & Continue' or 'Continue'")
        If response = "" Then
            Exit Sub
        ElseIf response = "Cancel" Or response = "Submit & Continue" Or response = "Continue" Then
            Select Case response
                Case "Cancel"
                    Exit Sub
                Case "Submit & Continue"
                    Call Submit
                Case "Continue"
                    '
            End Select
        Else
            MsgBox ("Invalid entry.  Please try again.")
            Exit Sub
        End If
    End If
        'the "carry on" part of your code goes here
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Perhaps you could just ask once like this.
If one of the three choices will be chosen more than the others then enter that in the DefaultChoice line or use "" for no default answer.

Rich (BB code):
Sub Decide()
    Dim Choice As Long
    
    Const DefaultChoice As String = "2"    '<- Use "" if you don't want a default to appear.
    
    Choice = Val(InputBox("You have not Submited Data Yet" & vbLf & "What would you like to do?" & vbLf & "Enter the number of your choice" & vbLf & _
                    "1 = Cancel" & vbLf & _
                    "2 = Submit & Continue" & vbLf & _
                    "3 = Continue" _
                        , , DefaultChoice))
    
    If Choice > 1 Then
      If Choice = 2 Then Call Submit
      
      'The 'Continue' code goes here
    
    End If
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

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