Message Box Madness

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,

I think not using Excel for so long has dimmed my skills, For whatever reason, I cannot figure out why I am having problems with making these message boxes appear in Excel. Here is what I have:


Code:
Sub goprompttest()Dim OutPut As Integer
If Range("E44").Value = 0 Then
    


    OutPut = MsgBox("Are you ready to save the temps?" & vbNewLine & "You will not be able to make any changes.", vbYesNo, "Final Check...")


    If OutPut = 6 Then
        'Output = 6(Yes)
        MsgBox "Saving...Your information has been logged.", vbInformation, "Saving..."
    ElseIf OutPut = 7 Then Exit Sub
        'Output = 7(No)
        
    End If
    
ElseIf Range("E44").Value <> 0 Then


    'Dim OutPut As Integer


    OutPut = MsgBox("You appear to have missed " + Range("E44").Value + " items." & vbNewLine & "Please go back and fill in all lines", vbYesNo, "UH-OH!!!")


    If OutPut = 6 Then
        'Output = 6(Yes)
        MsgBox "Saving...Thank you.", vbInformation, "Saving..."
    ElseIf OutPut = 7 Then Exit Sub
        'Output = 7(No)
        
    End If
End If
End Sub

Basically what I am trying to do is look at the value in E44, and if it is "0" then have one set of YesNO prompts, and if it is not "0", then have a different set of YesNo prompts.

Any assistance to fix my mental macro madness would be greatly appreciated!!!

- Andrew
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Maybe ...

Code:
Sub goprompttest()
  Dim nMissing      As Long

  nMissing = Range("E44").Value

  If nMissing Then
    If MsgBox(Prompt:="Are you ready to save the temps?" & vbLf & _
                      "You will not be able to make any changes.", _
              Buttons:=vbYesNo, _
              Title:="Final Check...") = vbYes Then
      MsgBox Prompt:="Saving...Your information has been logged.", _
             Buttons:=vbInformation, _
             Title:="Saving..."
    End If
  Else
    MsgBox Prompt:="You missed " & nMissing & " items." & vbLf & _
                   "Please go back and fill in all lines", _
           Buttons:=vbOKOnly, _
           Title:="UH-OH!!!"
  End If
End Sub

Note that the code doesn't save anything.
 
Upvote 0
Thank you very much, I haven't added the rest of the code I was going to use just yet, as I was struggling to get that part working.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,173
Members
451,543
Latest member
cesymcox

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