excel中大小写之间切换
发布网友
发布时间:2022-04-22 21:44
我来回答
共3个回答
热心网友
时间:2022-04-28 03:18
这需要一个函数,以下是代码。在工作表标签上右击>查看代码,打开窗口,在菜单栏上点击插入(I)>模块(M),在编辑窗口粘上以下代码。
使用时在单元格中输入=DX(100),则得到壹佰元整。
Function dx(q)
Dim cur As Long, yuan As Long
Dim jiao As Integer, fen As Integer
Dim cnyuan As String, cnjiao As String, cnfen As String
If q = "" Then
dx = 0
Exit Function
End If
cur = Round(q * 100)
yuan = Int(cur / 100)
jiao = Int(cur / 10) - yuan * 10
fen = cur - yuan * 100 - jiao * 10
cnyuan = Application.WorksheetFunction.Text(yuan, "[dbnum2]")
cnjiao = Application.WorksheetFunction.Text(jiao, "[dbnum2]")
cnfen = Application.WorksheetFunction.Text(fen, "[dbnum2]")
dx = cnyuan & "元" & "整"
d1 = cnyuan & "元"
If fen <> 0 And jiao <> 0 Then
dx = d1 & cnjiao & "角" & cnfen & "分"
If yuan = 0 Then
dx = cnjiao & "角" & cnfen & "分"
End If
End If
If fen = 0 And jiao <> 0 Then
dx = d1 & cnjiao & "角" & "整"
If yuan = 0 Then
dx = cnjiao & "角" & "整"
End If
End If
If fen <> 0 And jiao = 0 Then
dx = d1 & cnjiao & cnfen & "分"
If yuan = 0 Then
dx = cnfen & "分"
End If
End If
End Function
热心网友
时间:2022-04-28 04:36
=upper(单元格) 转换成大写
=lower(单元格) 转换成小写
热心网友
时间:2022-04-28 06:11
改变格式就可以了