路边 发表于 2005-8-1 18:36:00

怎样保留三位小数??(求助!!)

<P>Sub nn()<BR>Dim a, b As Double<BR>Dim c As String<BR>a = 10006466.20023<BR>b = FormatNumber(a, 3)<BR>c = FormatNumber(a, 3)<BR>MsgBox (b)<BR>MsgBox (c)<BR>b = Int(a * 1000 + 0.5) / 1000<BR>MsgBox (b)<BR>End Sub</P>
<P>显示结果为10006466.2或者10,006,466.200</P>
<P>问怎样才能使结果为10006466.200</P>
<P>请各位仁兄帮忙!!</P>

czlj2008 发表于 2005-8-1 19:33:00

b = Int(a * 1000 + 0.5) / 1000<BR>b=format(b,"0.000")

路边 发表于 2005-8-2 08:10:00

谢谢!!!

swjtu2000 发表于 2005-8-3 19:59:00

<P>round(value,n)</P>
<P>n为保留位数</P>
页: [1]
查看完整版本: 怎样保留三位小数??(求助!!)