|
楼主 |
发表于 2012-4-9 08:00
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
柚子哦 发表于 2012-4-8 21:35
为什么我的EX07里没有SUZI这个公式,如何得出这个公式,请说明
SuZi() 本人编写的自定义函数。在供下载的文件中。
我现在把它单独列出。你可以拷贝使用:
' 试编写金额中文大写转数字函数
' lin jin xiang 18/10/2004
Function SuZi(A As String) ' 人民币中文大写转数字函数
Application.Volatile True
Hsf = "分角元拾佰仟万 亿"
Hs = "零壹贰叁肆伍陆柒捌玖 "
JH = 1
A = Replace(A, "整", "")
A = Replace(A, "亿", ")亿")
A = Replace(A, "万", ")万")
If A <> "" Then
Mylen = Len(A$)
For m = 1 To Mylen
If Mid(A, m, 1) = "万" And JH = 1 Then A = "(" & A: JH = 0
If Mid(A, m, 1) = "亿" Then
A = "(" & A
JH = 0
For K = m + 3 To Mylen + 2
If Mid(A$, K, 1) = "万" Then
A = Replace(A, "亿", "亿(")
Exit For
End If
Next
Exit For
End If
Next
For i = 0 To 10
A = Replace(A, Mid(Hs, i + 1, 1), i)
A = Replace(A, Mid(Hsf, i + 1, 1), "*" & (10 ^ (i - 2)) & "+")
Next
A = Replace(A, "+)", ")")
A = Replace(A, "+*", "*")
Mylen = Len(A)
A = Left(A, Mylen - 1)
SuZi = Evaluate(A)
End If
End Function |
|