Variable with Single Data Type rounded to 2 decimal places

A

Amy Dickens

I'm working in Word 2002. How do I round my variable to 2
decimal places?

Thanks. Amy
 
P

Perry

Sorry for the duplicate.
Don't worry :))

Use the Round() function
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fox7help/ht
ml/lngroundlp_rp.asp

You can achieve the same by using other functions. Sometimes the
below examplified functions suit better ...
(note: for the output the decimal sep in my OS lang setting is a ","
and not the dot ".")

Immediate window output:
MyVar = 1002.009
? Format(MyVar, "standard")
1.002,01
? Format(MyVar, "#.00")
1002,01
? MyVar
1002,009
MyVar = CDbl(CStr(Format(MyVar, "#.00")))
? MyVar
1002,01

Using Type conversion functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/
vagrptypeconversion.asp

Format() function
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/
vafctFormat.asp

Krgrds,
Perry
 

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

Top