概要: Case 10 ^ 11: AAA = "亿" End Select End IfEnd Function Public Function abc(number As Variant, canshu As Long) As String Dim C, D, Y, X, Z As String Dim A, b, k A = Int(number * 100 + 0.5) b = Len(CStr(A)) D = CStr(A) If (b > 14) Then MsgBox "数字过大无法转换": Exit Function If (number < 0) Then MsgBox "错误:不可传入负值": Exit Function If A = 0 Then abc = "": Exit Function For k = 1 To b Select Case canshu Case
Excel中把小写金额转换成大写的技巧,标签:Excel教程,电脑基础教程,http://www.wenxue9.com
Case 10 ^ 11: AAA = "亿"
End Select
End If
End Function
Public Function abc(number As Variant, canshu As Long) As String
Dim C, D, Y, X, Z As String
Dim A, b, k
A = Int(number * 100 + 0.5)
b = Len(CStr(A))
D = CStr(A)
If (b > 14) Then MsgBox "数字过大无法转换": Exit Function
If (number < 0) Then MsgBox "错误:不可传入负值": Exit Function
If A = 0 Then abc = "": Exit Function
For k = 1 To b
Select Case canshu
Case 1
Y = AAA(Mid(D, b - k + 1, 1)) + AAA(10 ^ k)
Select Case k
Case 1
If Mid(D, b, 1) = "0" Then C = "整" Else C = Y + C
Case 2, 4, 5, 6, 8, 9, 10, 12, 13, 14
If Mid(D, b - k + 1, 2) = "00" Then C = C _
Else: _
If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) <> "0" Then _
C = "零" + C Else: C = Y + C
Case 7
If b >= 11 Then
If Mid(D, b - k - 2, 4) = "0000" Then
C = C
Else
If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) = "0" _
Then C = AAA(10 ^ k) + C _
Else: If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) <> "0" _
Then C = AAA(10 ^ k) + "零" + C Else: C = Y + C
End If
Else
If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) = "0" _
Then C = AAA(10 ^ k) + C _
Else: If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) <> "0" _
Then C = AAA(10 ^ k) + "零" + C Else: C = Y + C
End If
Case 3, 11
If Mid(D, b - k + 1, 1) = "0" And Mid(D, b - k + 2, 1) = "0" _
Then C = AAA(10 ^ k) + C _
上一页 [1] [2] [3] 下一页
Tag:Excel技巧,Excel教程,电脑基础教程,电脑知识 - 办公技巧 - Excel技巧
上一篇:Excel 2007数字格式与文本格式的互转