打开你所要操作的表格,右击sheet,选择查看代码

2.在空白处建立新模块
输入此代码Function Getpychar(char)
temp = 65536 + Asc(char)
If (temp >= 45217 And temp <= 45252) Then
Getpychar = "A"
ElseIf (temp >= 45253 And temp <= 45760) Then
Getpychar = "B"
ElseIf (temp >= 45761 And temp <= 46317) Then
Getpychar = "C"
ElseIf (temp >= 46318 And temp <= 46825) Then
Getpychar = "D"
ElseIf (temp >= 46826 And temp <= 47009) Then
Getpychar = "E"
ElseIf (temp >= 47010 And temp <= 47296) Then
Getpychar = "F"
ElseIf (temp >= 47297 And temp <= 47613) Then
Getpychar = "G"
ElseIf (temp >= 47614 And temp <= 48118) Then
Getpychar = "H"
ElseIf (temp >= 48119 And temp <= 49061) Then
Getpychar = "J"
ElseIf (temp >= 49062 And temp <= 49323) Then
Getpychar = "K"
ElseIf (temp >= 49324 And temp <= 49895) Then
Getpychar = "L"
ElseIf (temp >= 49896 And temp <= 50370) Then
Getpychar = "M"
ElseIf (temp >= 50371 And temp <= 50613) Then
Getpychar = "N"
ElseIf (temp >= 50614 And temp <= 50621) Then
Getpychar = "O"
ElseIf (temp >= 50622 And temp <= 50905) Then
Getpychar = "P"
ElseIf (temp >= 50906 And temp <= 51386) Then
Getpychar = "Q"
ElseIf (temp >= 51387 And temp <= 51445) Then
Getpychar = "R"
ElseIf (temp >= 51446 And temp <= 52217) Then
Getpychar = "S"
ElseIf (temp >= 52218 And temp <= 52697) Then
Getpychar = "T"
ElseIf (temp >= 52698 And temp <= 52979) Then
Getpychar = "W"
ElseIf (temp >= 52980 And temp <= 53640) Then
Getpychar = "X"
ElseIf (temp >= 53689 And temp <= 54480) Then
Getpychar = "Y"
ElseIf (temp >= 54481 And temp <= 62289) Then
Getpychar = "Z"
Else
Getpychar = char
End If
End Function
Function Getpy(str)
For a = 1 To Len(str)
Getpy = Getpy & Getpychar(Mid(str, a, 1))
Next a
End Function

点击保存,弹出对话框选择是

只需在B2单元格中输入函数“=Getpy(A2)”,然后进行单元格填充就可以啦。

1.《excel中提取拼音首字母 提取拼音首字母》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。

2.《excel中提取拼音首字母 提取拼音首字母》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。

3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/shehui/2282104.html