format variable to 3 decimal

  • Thread starter Thread starter Wandering Mage
  • Start date Start date
W

Wandering Mage

What I am trying to do, is use a variable to as part of
the name in a Chart that is created using a macro. When I
go Round(takttime, 3), takttime is the variable, and it
will round out to 3 decimals as it is supposed to, but I
also want it to SHOW THE ZEROS UP TO # DECIMALS. So, for
instance, a 5 should show up as 5.000. The problem is, I
am not just writing to a cell, so its not like I can just
format the cell to 3 decimals and be done with it. Does
anyone know how I get this to output to include 0's when
rounding? Help is, very much, as always, appreciated!
Thanks:)
 
Use the Format function:

=Format(Round(taktime,3),"#.000")

This converts to Text and specifies the format so it can
be assigned to any String variable or to things like the
names in your chart, etc. For more info look up the
Format function and "User-Defined Numeric Formats" in VBA
help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top