'数字转换成大写金额,你可以根据你的需要修改就可以
Function CurrencyToStr(ByVal Number As Currency) As String
Number = Val(Trim(Number))
If Number = 0 Then CurrencyToStr = "": Exit Function
Dim str1Ary As Variant, str2Ary As Variant
str1Ary = Split("零 壹 贰 叁 肆 伍 陆 柒 捌 玖")
str2Ary = Split("分 角 元 拾 佰 仟 万 拾 佰 仟 亿 拾 佰 仟 万 拾 佰")
Dim A As Long, B As Long '循环基数
Dim tmp1 As String '临时转换
Dim tmp2 As String '临时转换结果
Dim Point As Long '小数点位置
tmp1 = Round(Number, 2)
tmp1 = Replace(tmp1, "-", "") '先去掉“-”号
Point = InStr(tmp1, ".") '取得小数点位置
If Point = 0 Then '如果有小数点,最大佰万亿
B = Len(tmp1) + 2 '加2位小数
Else
B = Len(Left(tmp1, Point + 1)) '包括点加2位小数
End If
''先将所有数字替换为中文
For A = 9 To 0 Step -1
tmp1 = Replace(Replace(tmp1, A, str1Ary(A)), ".", "")
Next
For A = 1 To B
B = B - 1
If Mid(tmp1, A, 1) <> "" Then
If B > UBound(str2Ary) Then Exit For
tmp2 = tmp2 & Mid(tmp1, A, 1) & str2Ary(B)
End If
Next
If tmp2 = "" Then CurrencyToStr = "": Exit Function
'去掉多余的零
For A = 1 To Len(tmp2)
tmp2 = Replace(tmp2, "零亿", "亿零")
tmp2 = Replace(tmp2, "零万", "万零")
tmp2 = Replace(tmp2, "零仟", "零")
tmp2 = Replace(tmp2, "零佰", "零")
tmp2 = Replace(tmp2, "零拾", "零")
tmp2 = Replace(tmp2, "零元", "元")
tmp2 = Replace(tmp2, "零零", "零")
tmp2 = Replace(tmp2, "亿万", "亿")
Next
If Point = 1 Then tmp2 = "零元" + tmp2
If Number < 0 Then tmp2 = "负" + tmp2
If Point = 0 Then tmp2 = tmp2 + "整"
CurrencyToStr = tmp2
End Function