limiting decimal places in a msg Box

obracey756

New Member
Joined
May 28, 2015
Messages
5
Hi all

First of all thanks for your help!

I'm trying to do something which I thought would be easy but it seems to beyond my (all be it limited) intelligence.

Im trying to create a button which when you click it and enter a number it takes that number and divides it by 230 and shows you the answer in a message box.
That bit's fine, however i'm trying to limit the answer to a couple of decibel places. This is my code;

Sub AmpCalculater()
Num = InputBox("Enter Watt")
If Len(Num) = 0 Then Exit Sub
MsgBox = Format(Num / 230, "0.00") & " Amps."
End Sub


What am I doing wrong?

Thanks for the help again

Ollie :)
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Remove the = from the MsgBox line.
 
Upvote 0
Glad to help. :) Welcome to the forum by the way.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,849
Members
449,096
Latest member
Erald

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