Possible to limit decimal digits in message box?

BrianAlmond

New Member
Joined
Mar 23, 2011
Messages
11
Hi,

I'm using a message box to display a calculated number, referencing a cell using an arithmetic equation. I have the format of the cell being referenced so that it is limited to 2 decimal places. However, when the message box is displayed, the format of the number changes to 14 decimal places.

Is there any way to limit the message box format of the number to two decimal places?!

Thanks!

-Brian
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
If your number is in A1

MsgBox Format(Range("A1").Value, "0.00")

or if you are using a defined variable

MsgBox Format(Variable, "0.00")
 
Upvote 0
Thanks for the response guys, and it works great on its own!

BUT, I'm trying to accomplish something like:

Code:
Sub DailyCapacityOutput()
    MsgBox Format("The current capacity is " & Range("H100").Value, "0.00" & " loads per hour.")
End Sub

How can I get the text AND the correctly formatting value together?
 
Upvote 0
Thanks for the response guys, and it works great on its own!

BUT, I'm trying to accomplish something like:

Code:
Sub DailyCapacityOutput()
    MsgBox Format("The current capacity is " & Range("H100").Value, "0.00" & " loads per hour.")
End Sub

How can I get the text AND the correctly formatting value together?

This should hopefully do the trick Brian :)

MsgBox "The current capacity is " & Format(Range("H100").Value, "0.00") & " loads per hour."

[Edit] Accidentally left a bracket on the end
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,334
Members
452,907
Latest member
Roland Deschain

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