Reputation: 3
I'm currently creating a userform in VBA where you input numbers, press calculate, and then the answer is returned in a textbox.
Currently the answer is being displayed to 10+ significant figures (see below). What would I need to do to make my calculated output display only 3 decimal places?
Thanks!
Calculation output example:
Upvotes: 0
Views: 5568
Reputation: 340
Format(myAnswer, "0.00")
will do it if you want 2 digits after the decimal point, just add more or less 0
's after the decimal point in the second argument to change the significant figures.
Here is a website about how to write number formats to use in this function.
Upvotes: 1