lofgren
lofgren

Reputation: 27

Merge multiple MsgBox into one

I am trying to merge multiple MsgBoxs into one, but i have no luck. If you have any ideea, please help. This is my VBA:

  If Worksheets("XXX").Range("D13") > 0 Then

MsgBox ("ATENTION!" & vbCrLf & "OLD = ") & Worksheets("XXX").Range("D13") & " PCS !"
End If

If Worksheets("XXX").Range("E13") > 0 Then
MsgBox ("ATENTION!" & vbCrLf & "REQUEST = ") & Worksheets("XXX").Range("E13") & " PCS !"
End If

Thank you!

Upvotes: 0

Views: 200

Answers (1)

Egan Wolf
Egan Wolf

Reputation: 3573

You want to show both messages in one box? Like this?

Dim msg As String
If Worksheets("XXX").Range("D13") > 0 Then
    msg = "ATENTION!" & vbCrLf & "OLD = " & Worksheets("XXX").Range("D13") & " PCS !"
End If

If Worksheets("XXX").Range("E13") > 0 Then
    msg = msg & vbCrLf & "ATENTION!" & vbCrLf & "REQUEST = " & Worksheets("XXX").Range("E13") & " PCS !"
End If
MsgBox msg

Upvotes: 1

Related Questions