请问大家  436.1  怎么格式化成   0436.1   啊 然后乘以 0.045 得到的结果格式化成  0019.6
强调 不能用   “0” & 436.1  和  “00”& 19.6

解决方案 »

  1.   


    强调 不能用 “0” & 436.1 和 “00”& 19.6***********************
      

  2.   

    奇怪的要求。既然是0436.1,肯定只能是文本而不能是数值,又怎么能不用"0" & ""?
      

  3.   

    Private Sub Form_Load()
    Dim a, b As Double
    Dim c As String
        a = 436.1
        b = 0.045
        a = FormatPoint(a)
        Debug.Print a
        c = FormatPoint(a*b)
        Debug.Print c
    End SubPrivate Function FormatPoint(ByVal pValue As Double) As String
       FormatPoint = Format(Mid(pValue, 1, InStr(1, pValue, ".") - 1), "0000") & Mid(pValue, InStr(1, pValue, "."), 2)
    End Function
      

  4.   

    计算的时候由它自行处理,输出的时候用 Format 函数.