excel提取汉字首字母vba函数
作者:xlnxin发布时间:2026-02-28分类:编程知识浏览:14
导读:Function GetPyChar(Char As String) As StringDim tmp A...
Function GetPyChar(Char As String) As String Dim tmp As Long tmp = 65536 + Asc(Char) If (tmp >= 45217 And tmp <= 45252) Then GetPyChar = "A" ElseIf (tmp >= 45253 And tmp <= 45760) Then GetPyChar = "B" ElseIf (tmp >= 45761 And tmp <= 46317) Then GetPyChar = "C" ElseIf (tmp >= 46318 And tmp <= 46825) Then GetPyChar = "D" ElseIf (tmp >= 46826 And tmp <= 47009) Then GetPyChar = "E" ElseIf (tmp >= 47010 And tmp <= 47296) Then GetPyChar = "F" ElseIf (tmp >= 47297 And tmp <= 47613) Then GetPyChar = "G" ElseIf (tmp >= 47614 And tmp <= 48118) Then GetPyChar = "H" ElseIf (tmp >= 48119 And tmp <= 49061) Then GetPyChar = "J" ElseIf (tmp >= 49062 And tmp <= 49323) Then GetPyChar = "K" ElseIf (tmp >= 49324 And tmp <= 49895) Then GetPyChar = "L" ElseIf (tmp >= 49896 And tmp <= 50370) Then GetPyChar = "M" ElseIf (tmp >= 50371 And tmp <= 50613) Then GetPyChar = "N" ElseIf (tmp >= 50614 And tmp <= 50621) Then GetPyChar = "O" ElseIf (tmp >= 50622 And tmp <= 50905) Then GetPyChar = "P" ElseIf (tmp >= 50906 And tmp <= 51386) Then GetPyChar = "Q" ElseIf (tmp >= 51387 And tmp <= 51445) Then GetPyChar = "R" ElseIf (tmp >= 51446 And tmp <= 52217) Then GetPyChar = "S" ElseIf (tmp >= 52218 And tmp <= 52697) Then GetPyChar = "T" ElseIf (tmp >= 52698 And tmp <= 52979) Then GetPyChar = "W" ElseIf (tmp >= 52980 And tmp <= 53640) Then GetPyChar = "X" ElseIf (tmp >= 53679 And tmp <= 54480) Then GetPyChar = "Y" ElseIf (tmp >= 54481 And tmp <= 62289) Then GetPyChar = "Z" Else GetPyChar = Char End If End Function Function GetPy(str As String) As String Dim i As Integer For i = 1 To Len(str) GetPy = GetPy & GetPyChar(Mid(str, i, 1)) Next i End Function
标签:excel
- 上一篇:excel汉字转拼音vba函数
- 下一篇:如何在公众号菜单栏添加往期发布历史文章链接
- 编程知识排行
- 最近发表

