请问能不能让这个代码简单点???
这是对从 初一 到 三十 的汉字转换为数子,可太长了,能不能有简单点的方法?Public Function ZhanHuan(NuberN As String) As Integer
Dim TempInter As Long
If NuberN = "初一" Then
TempInter = "1"
ElseIf NuberN = "初二" Then
TempInter = "2"
ElseIf NuberN = "初三" Then
TempInter = "3"
ElseIf NuberN = "初四" Then
TempInter = "4"
ElseIf NuberN = "初五" Then
TempInter = "5"
ElseIf NuberN = "初六" Then
TempInter = "6"
ElseIf NuberN = "初七" Then
TempInter = "7"
ElseIf NuberN = "初八" Then
TempInter = "8"
ElseIf NuberN = "初九" Then
TempInter = "9"
ElseIf NuberN = "初十" Then
TempInter = "10"
ElseIf NuberN = "十一" Then
TempInter = "11"
ElseIf NuberN = "十二" Then
TempInter = "12"
ElseIf NuberN = "十三" Then
TempInter = "13"
ElseIf NuberN = "十四" Then
TempInter = "14"
ElseIf NuberN = "十五" Then
TempInter = "15"
ElseIf NuberN = "十六" Then
TempInter = "16"
ElseIf NuberN = "十七" Then
TempInter = "17"
ElseIf NuberN = "十八" Then
TempInter = "18"
ElseIf NuberN = "十九" Then
TempInter = "19"
ElseIf NuberN = "二十" Then
TempInter = "20"
ElseIf NuberN = "廿一" Then
TempInter = "21"
ElseIf NuberN = "廿三" Then
TempInter = "23"
ElseIf NuberN = "廿四" Then
TempInter = "24"
ElseIf NuberN = "廿五" Then
TempInter = "25"
ElseIf NuberN = "廿六" Then
TempInter = "26"
ElseIf NuberN = "廿七" Then
TempInter = "27"
ElseIf NuberN = "廿八" Then
TempInter = "28"
ElseIf NuberN = "廿九" Then
TempInter = "29"
ElseIf NuberN = "三十" Then
TempInter = "30"
ElseIf NuberN = "卅一" Then
TempInter = "31"
ElseIf NuberN = "廿二" Then
TempInter = "22"
Else
If IsNumeric(NuberN) Then
TempInter = NuberN
Else
'MsgBox "输入错误,请输入日期类型" & vbCrLf & "如:1 、2、初一、初十、廿一、卅一等", vbExclamation, "错误"
Exit Function
End If
End If
ZhanHuan = TempInter
End Function