经验直达:
- excel怎么把把的汉字转换成拼音
- excel怎么把汉字转换成拼音
一、excel怎么把把的汉字转换成拼音
【excel怎么把汉字转换成拼音 excel怎么把把的汉字转换成拼音】1、打开要转换成拼音的excel表格
2、按“Alt F11”组合键,进入Visual Basic编辑状态 。也就是看到的这个灰色的编辑界面
3、执行“插入→模块”命令,插入一个新模块 。再双击插入的模块,进入模块代码编辑状态;
4、看到如下界面
5、把下面的所有内容复制,粘贴到步骤4中的空白处
复制内容到剪贴板
Function pinyin(p As String) As String
i = Asc(p)
Select Case i
Case -20319 To -20318: pinyin = "a "
Case -20317 To -20305: pinyin = "ai "
Case -20304 To -20296: pinyin = "an "
Case -20295 To -20293: pinyin = "ang "
Case -20292 To -20284: pinyin = "ao "
Case -20283 To -20266: pinyin = "ba "
Case -20265 To -20258: pinyin = "bai "
Case -20257 To -20243: pinyin = "ban "
Case -20242 To -20231: pinyin = "bang "
Case -20230 To -20052: pinyin = "bao "
Case -20051 To -20037: pinyin = "bei "
Case -20036 To -20033: pinyin = "ben "
Case -20032 To -20027: pinyin = "beng "
Case -20026 To -20003: pinyin = "bi "
Case -20002 To -19991: pinyin = "bian "
Case -10587 To -10545: pinyin = "zhi "
Case -10544 To -10534: pinyin = "zhong "
Case -10533 To -10520: pinyin = "zhou "
Case -10519 To -10332: pinyin = "zhu "
Case -10331 To -10330: pinyin = "zhua "
Case -10329 To -10329: pinyin = "zhuai "
Case -10328 To -10323: pinyin = "zhuan "
Case -10322 To -10316: pinyin = "zhuang "
Case -10315 To -10310: pinyin = "zhui "
Case -10309 To -10308: pinyin = "zhun "
Case -10307 To -10297: pinyin = "zhuo "
Case -10296 To -10282: pinyin = "zi "
Case -10281 To -10275: pinyin = "zong "
Case -10274 To -10271: pinyin = "zou "
Case -10270 To -10263: pinyin = "zu "
Case -10262 To -10261: pinyin = "zuan "
Case -10260 To -10257: pinyin = "zui "
Case -10256 To -10255: pinyin = "zun "
Case -10254 To -10254: pinyin = "zuo "
Case Else: pinyin = p
End Select
End Function
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy & pinyin(Mid(str, i, 1))
Next i
End Function
6、按下ALT Q关闭Visual Basic编辑窗口,返回Excel编辑状态
7、选中转换后的拼音需要放在哪个列 , 例如要把B列的第2行的内容转换成拼音,放在D列的第2个单元格,输入公式:=getpy(B2),这里的B2,是指源头单元格的坐标
8、如果要去除拼音之间的空格 。去掉空格的拼音放在E列,如果这个未去掉空格的数据原来在D2单元格,去掉空格之后的拼音放在E2单元格,则在E2单元格输入:
=SUBSTITUTE(D2," ","")
二、excel怎么把汉字转换成拼音
1.启动Excel 2003(其它版本请仿照操作),打开相应的工作表;
2.执行“工具→宏→Visual Basic编辑器”命令(或者直接按“Alt F11”组合键),进入Visual Basic编辑状态;
3.执行“插入→模块”命令 , 插入一个新模块 。再双击插入的模块,进入模块代码编辑状态;
4.将代码输入其中;字数太多 , 你在下面链接区复制完整代码
http://jingyan.baidu.com/article/cd4c2979ee7808756e6e6085.html
5.代码输入完成后,直接关闭Visual Basic编辑窗口,返回Excel编辑状态;
6.自定义函数就可以用了,如:选中A2单元格,输入公式:=getpy(A2) 。