以下是引用irene2008在2008-6-17 21:31:00的发言: 楼主大哥,我是初学者,这个转换我刚好要用到,但你所推荐的我看不懂哦,下载后打开EXCEL都是“#NAME?”这样的字符,能告诉我下是怎么回事吗?这个具体是怎么操作的啊?[em04] 可能在下载过程,宏丢失了。可把你要的函数复制到你的新工作薄vba中。 ' 试编写数字金额转中文大写的函数 ' lin jin xiang 08-07-2004 ' 重编辑 23-01-2005 Function DaXie(ByVal Num) ' 人民币中文大写函数 Application.Volatile True Place = "分角元拾佰仟万拾佰仟亿拾佰仟万" Dn = "壹贰叁肆伍陆柒捌玖" D1 = "整零元零零零万零零零亿零零零万" If Num < 0 Then FuHao = "(负)" Num = Format(Abs(Num), "###0.00") * 100 If Num > 999999999999999# Then: DaXie = "数字超出转换范围!!": Exit Function If Num = 0 Then: DaXie = "零元零分": Exit Function NumA = Trim(Str(Num)) NumLen = Len(NumA) For J = NumLen To 1 Step -1 ' 数字转换过程 Temp = Val(Mid(NumA, NumLen - J + 1, 1)) If Temp <> 0 Then ' 非零数字转换 NumC = NumC & Mid(Dn, Temp, 1) & Mid(Place, J, 1) Else ' 数字零的转换 If Right(NumC, 1) <> "零" Then NumC = NumC & Mid(D1, J, 1) Else Select Case J ' 特殊数位转换 Case 1 NumC = Left(NumC, Len(NumC) - 1) & Mid(D1, J, 1) Case 3, 11 NumC = Left(NumC, Len(NumC) - 1) & Mid(D1, J, 1) & "零" Case 7 If Mid(NumC, Len(NumC) - 1, 1) <> "亿" Then NumC = Left(NumC, Len(NumC) - 1) & Mid(D1, J, 1) & "零" End If Case Else End Select End If End If Next DaXie = FuHao & Trim(NumC) End Function
[此贴子已经被作者于2008-6-18 19:26:24编辑过] |