msg box in VBA

andrewb90

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

I have attempted (rather unsuccessfully) to combine 2 separate codes and now I can't get the message box to appear. Anybody have an input to help me?

Code:
Sub sales1()Dim Msg, Style, Title
Rows("125:136").Hidden = Not Rows("125:136").Hidden
If Range("K170").Value < Range("Info!E34") Then
Msg = "It looks like you are low on Pizza Baking Instructions. You have just " & Range("K170").Value & " instructions remaining."
Style = vbOKOnly + vbExclamation
Title = "MsgBox Demonstration"
End If
End Sub

Thanks,

Andrew
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

To display the message box if the condition is met, add the part in red below before your End If statement:
Code:
[COLOR=#b22222][B]MsgBox Msg, Style, Title[/B][/COLOR]
End If
 
Upvote 0

Forum statistics

Threads
1,215,555
Messages
6,125,490
Members
449,234
Latest member
slzaleski

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