|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Function DONG1(Range1 As Range)
Dim Z As Byte
Dim Y As String
Dim X As Byte
Dim W As String
Dim D1 As String
Dim iNo As String
Dim iUnit As String
DONG1 = ""
iNo = "分角元拾佰仟零壹贰叁肆伍陆柒捌玖"
Y = Right(CStr(Round(Range1 * 100, 0)), 15)
X = Len(Right(CStr(Round(Range1 * 100, 0)), 15))
For Z = 1 To Len(Y)
W = Mid$(Y, Z, 1)
DONG1 = DONG1 & IIf(D1 & W = "00", "", Mid(iNo, Val(W) + 7, 1))
If (X = 7 Or X = 11) And W = "0" Then DONG1 = Left$(DONG1, Len(DONG1) - 1)
iUnit = ""
Select Case X
Case 7, 11
iUnit = IIf(X = 7, IIf(Right$(DONG1, 1) = "亿", "", "万"), "亿")
Case 4 To 6, 8 To 10, 12 To 14
iUnit = IIf(W = "0", "", Mid(iNo, X - Switch(X > 11, 11 - 3, X > 7, 7 - 3, X > 3, 3 - 3), 1))
Case 1 To 3
iUnit = Mid(iNo, X, 1)
End Select
DONG1 = DONG1 & IIf(X = 7 Or X = 11, iUnit, IIf(W = "0", "", iUnit))
D1 = W
X = X - 1
Next
W = Right$(DONG1, 1)
If W = "零" Then DONG1 = Left$(DONG1, Len(DONG1) - 1)
W = Right$(DONG1, 1)
If Right$(Y, 2) = "00" Then DONG1 = DONG1 & IIf(W = "元", "整", "元整")
If Right$(DONG1, 1) = "角" Then DONG1 = DONG1 & "零分"
End Function |
|