3个回答
展开全部
Public Function 中文大写(数字 As Currency) As String
Dim a As Variant, b As Integer, c As Integer
Dim q(1 To 9) As String, s1 As Variant
q(1) = "壹": q(2) = "贰": q(3) = "叁": q(4) = "肆"
q(5) = "伍": q(6) = "陆": q(7) = "柒": q(8) = "捌": q(9) = "玖"
a = Int(数字)
b = Val(Mid(Str(数字), InStr(1, Str(数字), ".") + 1, 1))
c = Val(Right(Application.Text(Str(数字 * 100), "0"), 1))
s1 = Application.Text(a, "[dbnum2]")
If a = 0 Then
If b = 0 Then
If c = 0 Then
中文大写 = ""
Exit Function
Else
中文大写 = q(c) & "分"
Exit Function
End If
ElseIf c = 0 Then
中文大写 = q(b) & "角整"
Exit Function
Else
中文大写 = q(b) & "角" & q(c) & "分"
Exit Function
End If
ElseIf b = 0 Then
If c = 0 Then
中文大写 = s1 & "元整"
Exit Function
Else
中文大写 = s1 & "元零" & q(c) & "分"
Exit Function
End If
ElseIf c = 0 Then
中文大写 = s1 & "元" & q(b) & "角整"
Exit Function
Else
中文大写 = s1 & "元" & q(b) & "角" & q(c) & "分"
Exit Function
End If
End Function
Dim a As Variant, b As Integer, c As Integer
Dim q(1 To 9) As String, s1 As Variant
q(1) = "壹": q(2) = "贰": q(3) = "叁": q(4) = "肆"
q(5) = "伍": q(6) = "陆": q(7) = "柒": q(8) = "捌": q(9) = "玖"
a = Int(数字)
b = Val(Mid(Str(数字), InStr(1, Str(数字), ".") + 1, 1))
c = Val(Right(Application.Text(Str(数字 * 100), "0"), 1))
s1 = Application.Text(a, "[dbnum2]")
If a = 0 Then
If b = 0 Then
If c = 0 Then
中文大写 = ""
Exit Function
Else
中文大写 = q(c) & "分"
Exit Function
End If
ElseIf c = 0 Then
中文大写 = q(b) & "角整"
Exit Function
Else
中文大写 = q(b) & "角" & q(c) & "分"
Exit Function
End If
ElseIf b = 0 Then
If c = 0 Then
中文大写 = s1 & "元整"
Exit Function
Else
中文大写 = s1 & "元零" & q(c) & "分"
Exit Function
End If
ElseIf c = 0 Then
中文大写 = s1 & "元" & q(b) & "角整"
Exit Function
Else
中文大写 = s1 & "元" & q(b) & "角" & q(c) & "分"
Exit Function
End If
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼主说的不是很具体,下面的内容请参考:
读取单元格的值,求出长度,利用循环逐个对单元格内的数字使用SELECT CASE语句 进行替换。
读取单元格的值,求出长度,利用循环逐个对单元格内的数字使用SELECT CASE语句 进行替换。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询