在Excel中,我想根据小写的金额自动生成大写金额
给你一个,放在工具里:
Function convert_digital_chinese(ByVal Myinput)
Dim Temp, TempA, MyinputA, MyinputB, MyinputC
Dim Place As String
Dim J As Integer
Place = "分角元拾佰仟万拾佰仟亿拾佰仟万"
shuzi1 = "壹贰叁肆伍陆柒捌玖"
shuzi2 = "整零元零零零万零零零亿零零零万"
qianzhui = ""
If Myinput < 0 Then qianzhui = "负"
Myinput = Int(Abs(Myinput) * ...全部
给你一个,放在工具里:
Function convert_digital_chinese(ByVal Myinput)
Dim Temp, TempA, MyinputA, MyinputB, MyinputC
Dim Place As String
Dim J As Integer
Place = "分角元拾佰仟万拾佰仟亿拾佰仟万"
shuzi1 = "壹贰叁肆伍陆柒捌玖"
shuzi2 = "整零元零零零万零零零亿零零零万"
qianzhui = ""
If Myinput < 0 Then qianzhui = "负"
Myinput = Int(Abs(Myinput) * 100 + 0。
5)
If Myinput > 999999999999999# Then
mychange = "数字太大了吧???"
Exit Function
End If
If Myinput = 0 Then
mychange = "零元零分"
Exit Function
End If
MyinputA = Trim(Str(Myinput))
shuzilong = Len(MyinputA)
For J = 1 To shuzilong
MyinputB = Mid(MyinputA, J, 1) & MyinputB
Next
For J = 1 To shuzilong
Temp = Val(Mid(MyinputB, J, 1))
If Temp = 0 Then
MyinputC = Mid(shuzi2, J, 1) & MyinputC
Else
MyinputC = Mid(shuzi1, Temp, 1) & Mid(Place, J, 1) & MyinputC
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "零" Then
Select Case Mid(MyinputC, J + 1, 1)
Case "零", "元", "万", "亿", "整":
MyinputC = Left(MyinputC, J - 1) & Mid(MyinputC, J + 1, 30)
J = J - 1
End Select
End If
Next
shuzilong = Len(MyinputC)
For J = 1 To shuzilong - 1
If Mid(MyinputC, J, 1) = "亿" And Mid(MyinputC, J + 1, 1) = "万" Then
MyinputC = Left(MyinputC, J) & Mid(MyinputC, J + 2, 30)
Exit For
End If
Next
mychange = qianzhui & Trim(MyinputC)
End Function。
收起