I'm working in Word 2002. How do I round my variable to 2 decimal places? Thanks. Amy
A Amy Dickens Jul 8, 2003 #1 I'm working in Word 2002. How do I round my variable to 2 decimal places? Thanks. Amy
P Perry Jul 8, 2003 #3 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
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