大写金额
1/———长————-Function NCN(account) 'Nummary Capital Number
ybb = Round(account * 100)
y = Int(ybb / 100)
j = Int(ybb / 10) - y * 10
f = ybb - y * 100 - j * 10
zy = Application.WorksheetFunction.Text(y, "[dbnum2]")
zj = Application.WorksheetFunction.Text(j, "[dbnum2]")
zf = Application.WorksheetFunction.Text(f, "[dbnum2]")
NCN = zy & "圆"
If j = 0 And f = 0 Then
NCN = NCN & "整"
End If
If f <> 0 And j <> 0 Then
NCN = NCN & zj & "角" & zf & "分"
If y = 0 Then
NCN = zj & "角" & zf & "分"
End If
End If
If f = 0 And j <> 0 Then
NCN = NCN & zj & "角"
If y = 0 Then
NCN = zj & "角"
End If
End If
If f <> 0 And j = 0 Then
NCN = NCN & zj & zf & "分"
If y = 0 Then
NCN = zf & "分"
End If
End If
If account = "" Then
NCN = ""
End If
End Function
2/———短————-Function ldy888(M)
y = Int(Round(100 * Abs(M)) / 100)
j = Round(100 * Abs(M) + 0.00001) - y * 100
f = Round((j / 10 - Int(j / 10)) * 10)
A = IIf(y < 1, "", Application.Text(y, "[DBNum2]") & "元") b = IIf(j > 9.4, Application.Text(Int(j / 10), "[DBNum2]") & "角", IIf(y < 1, "", IIf(f > 0.4, "零", "")))
c = IIf(f < 1, "整", Application.Text(Round(f, 0), "[DBNum2]") & "分")
ldy888 = IIf(Abs(M) < 0.005, "", IIf(M < 0, "负" & A & b & c, A & b & c))
End Function
3/———好短啊———Public Function dx(n)
dx = Replace(Application.Text(Round(n + 0.00000001, 2), "[DBnum2]"), ".", "元")
dx = IIf(Left(Right(dx, 3), 1) = "元", Left(dx, Len(dx) - 1) & "角" & Right(dx, 1) & "分", IIf(Left(Right(dx, 2), 1) = "元", dx & "角整", IIf(dx = "零", "", dx & "元整")))
dx = Replace(Replace(Replace(Replace(dx, "零元零角", ""), "零元", ""), "零角", "零"), "-", "负")
End Function
浙公网安备 33010602011771号