軟件版本:Office2013 方法如下: 1.Alt+F11,打開VBA編輯界面,插入模塊,在模塊中輸入如下代碼: Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319 To -20318: pinyin = "a " ……(受字?jǐn)?shù),中間部分省略) Ca
在Excel表格的統(tǒng)計(jì)工作中,有時(shí)候需要將漢字轉(zhuǎn)換為拼音。那么如何將漢字批量轉(zhuǎn)換為拼音呢?這就需要用到宏代碼,下面就為大家介紹詳細(xì)方法:
材料/工具
Excel軟件
第一步:創(chuàng)建自定義函數(shù)。代碼如下: Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319 To -20318: pinyin = "a " 省略(因有字?jǐn)?shù)) Case -10254 To -10254: pinyin = "zuo " Case Else: pinyin = p End Selec
方法
首先打開Excel軟件
打開Excel->工具->宏->Viaual Basic編輯器 在彈出來的窗口中對(duì)著VBAproject點(diǎn)右鍵->插入->模塊 下面會(huì)出現(xiàn)一個(gè)名為"模塊1",點(diǎn)擊 在右邊的空白欄中粘貼以下內(nèi)容: Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319
如圖所示,如果需要將表格中的姓名由漢字轉(zhuǎn)換為拼音
VBA自定義函數(shù),按ALT+F11插入模塊,在右面窗口中復(fù)制粘貼下面代碼: 若B10內(nèi)容為 中國(guó)航天6號(hào)a,則在某空白格中輸入:=hztopy(B10) 即可 Function hztopy(hzpy As String) As String Dim hzstring As String, pystring As String Dim hzpysum
首先,在鍵盤上按住“Alt+F11”組合鍵,進(jìn)入Visual Basic編輯狀態(tài)。
打開Excel->工具->宏->Viaual Basic編輯器 在彈出來的窗口中對(duì)著VBAproject點(diǎn)右鍵->插入->模塊 下面會(huì)出現(xiàn)一個(gè)名為"模塊1",點(diǎn)擊 在右邊的空白欄中粘貼以下內(nèi)容: Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319
在Visual Basi面板上方用鼠標(biāo)左鍵單擊“插入”選項(xiàng),再在插入選擇項(xiàng)里單擊“模塊”,插入一個(gè)新的模塊,然后雙擊插入的模塊,在插入的模塊里進(jìn)行編輯。
1.啟動(dòng)Excel,打開相應(yīng)的工作表。 2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài)。 3.執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編輯狀態(tài)。 4.將代碼輸入其中。
在編輯欄里復(fù)制如下內(nèi)容:
用自定義函數(shù)與EXCEL函數(shù)結(jié)合,如圖,如附件。記得加載宏; =SUBSTITUTE(SUBSTITUTE(Getpy(A1),MID(Getpy(A1),1,FIND("
1.啟動(dòng)Excel,打開相應(yīng)的工作表。 2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài)。 3.執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編輯狀態(tài)。 4.將代碼輸入其中。
Function pinyin(p As String) As String
以Excel2007為例: 1、打開相應(yīng)的Excel文件,按“Alt+F11”組合鍵,彈出“Visual Basic編輯器”如下圖: 2、鼠標(biāo)點(diǎn)擊“Visual Basic編輯器”菜單欄的“插入”選項(xiàng),選擇下拉列表里的“模塊”,插入“模塊”,如下圖: 3、將下面的代碼復(fù)制粘貼到里面: Functi
i = Asc(p)
可以但用起來很復(fù)雜累人,也不可能在這里說明白,只在這里說的一下簡(jiǎn)單的無理,以其中一種方法為例。 利用VLOOKUP這類的函數(shù),在次列把本列單元格內(nèi)拼音轉(zhuǎn)換成漢字。 首先別設(shè)一張引用源數(shù)據(jù)表,A列是拼間 B列為漢字 通函數(shù)依引用源數(shù)據(jù)表A列為
Select Case i
1、首先選中姓名單元格區(qū)域,點(diǎn)擊右上角的工具箱。 2、然后點(diǎn)擊頁(yè)面上方的拼音筆畫。 3、點(diǎn)擊打開列表中的漢字轉(zhuǎn)拼音。 4、接著點(diǎn)擊頁(yè)面中間的確定按鈕。 5、選擇將結(jié)果保存的位置點(diǎn)擊確定。 6、最后就可以看到所有的漢字都轉(zhuǎn)換成了拼音。
Case -20319 To -20318: pinyin = "a "
啟動(dòng)Excel (其它版本請(qǐng)仿照操作),打開相應(yīng)的工作表; 2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài); 執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編輯狀態(tài);
Case -20317 To -20305: pinyin = "ai "
根據(jù)GB2312-1980 信息交換用漢字編碼字符集 漢字分為一級(jí)漢字(3755個(gè))和二級(jí)漢字(3008)個(gè),一級(jí)漢字使用拼音排序,二級(jí)漢字使用筆畫排序。因此對(duì)于一級(jí)漢字比較好辦,找到每個(gè)拼音開始和結(jié)束的漢字內(nèi)碼即可。 對(duì)于二級(jí)漢字還沒有好的辦法,
Case -20304 To -20296: pinyin = "an "
下面是一個(gè)VBA自定義函數(shù),按ALT+F11,插入模塊,在右面窗口中粘貼下面代碼。 若B10內(nèi)容為 中國(guó)航天6號(hào)a,則在某空白格中輸入:=hztopy(B10) 即可 Function hztopy(hzpy As String) As String Dim hzstring As String, pystring As String Dim
Case -20295 To -20293: pinyin = "ang "
在word 和EXCEL中,都可以: 選中內(nèi)容----格式---拼音指南 但,在EXCEL中,用起來不如word 中方便,可以在word中形成,再粘貼到別的地方,如粘貼到EXCEL中。 如(rú)何(hé)將(jiāng)EXCEL表(biǎo)格(gé)中(zhōng)的(de)漢(hàn)字(zì)轉(zhuǎn)(zhuǎn)為(
Case -20292 To -20284: pinyin = "ao "
親,這個(gè)可以用VBA編寫自定義函數(shù)解決。但是對(duì)于生僻字和多音字并不能完全正確識(shí)別。 打開你的Excel文件,按“Alt+F11”打開VBA編輯窗口,然后在左側(cè)空白處點(diǎn)擊右鍵,“插入”,“模塊”。右側(cè)空白處粘貼下面的代碼。關(guān)閉VBA窗口。 代碼太長(zhǎng),超字?jǐn)?shù)限
Case -20283 To -20266: pinyin = "ba "
自定義函數(shù),借用VLOOKUP函數(shù)。 宏代碼如下: Public Function MyFun(rng1 As Range) As String Dim Len_rng1 As Integer Dim aa As String aa = "" Len_rng1 = Len(rng1.Value) For i = 1 To Len_rng1 A1 = Mid(rng1.Value, i, 1) If aa = "" T
Case -20265 To -20258: pinyin = "bai "
直接轉(zhuǎn)換是不太可能了,有工具網(wǎng)頁(yè):http://www.aies.cn/pinyin.htm
Case -20257 To -20243: pinyin = "ban "
以WPS 2019為例, 關(guān)于這版本的wps表格,如何給文字加拼音。 目前WPS表格中不支持拼音指南的功能,可多多關(guān)注后續(xù)版本是否有增加您所需要的需求。 在「文字(Word」中的功能可參考下圖設(shè)置,添加后可在表格中「右鍵-選擇性粘貼-選擇WPS文字 文件
Case -20242 To -20231: pinyin = "bang "
漢字轉(zhuǎn)拼音,目前Excel沒有這樣的功能,而且你還要轉(zhuǎn)換后分行。 可以用VBA自定義一個(gè)函數(shù),不實(shí)現(xiàn)對(duì)漢字的轉(zhuǎn)換。 請(qǐng)參考如下代碼(函數(shù)名為PY): Option Compare TextFunction PY(ByVal rng As Range) Dim i%, k%, str$ str = Replace(Replace(
Case -20230 To -20052: pinyin = "bao "
excel表里怎么檢查漢字轉(zhuǎn)化成的拼音都是正確的 5 我來答 分享 微信掃一掃 新浪微博 QQ空間 舉報(bào) 瀏覽9 次 可選中1個(gè)或多個(gè)下面的關(guān)鍵詞,搜索相關(guān)資料
Case -20051 To -20037: pinyin = "bei "
具體比較復(fù)雜,VBA Public Function HzToPy(Hz As String, _ Optional Sep As String = "", _ Optional NotationType As Integer = -1, _ Optional ShowInitialOnly As Boolean = False, _ Optional ShowOnlyOneChar As Boolean = False) As Str
Case -20036 To -20033: pinyin = "ben "
由于字符太多,你看下這個(gè)帖子就明白了 http://jingyan.baidu.com/article/cd4c2979ee7808756e6e6085.html
Case -20032 To -20027: pinyin = "beng "
1.打開excel2007---“開始”菜單下,如圖: 2.找到“顯示和隱藏字段的標(biāo)識(shí)”。 3.選中有漢字的單元格,然后點(diǎn)擊這個(gè)標(biāo)識(shí)旁邊的倒三角,選擇——編輯拼音,就可以為漢字編輯拼音了,編輯完之后,選中該單元格,再點(diǎn)擊倒三角,選擇——顯示拼音字段,就標(biāo)
Case -20026 To -20003: pinyin = "bi "
1.啟動(dòng)Excel 2003(其它版本請(qǐng)仿照操作),打開相應(yīng)的工作表; 2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài); 3.執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編
Case -20002 To -19991: pinyin = "bian "
Case -19990 To -19987: pinyin = "biao "
Case -19986 To -19983: pinyin = "bie "
Case -19982 To -19977: pinyin = "bin "
Case -19976 To -19806: pinyin = "bing "
Case -19805 To -19785: pinyin = "bo "
Case -19784 To -19776: pinyin = "bu "
Case -19775 To -19775: pinyin = "ca "
Case -19774 To -19764: pinyin = "cai "
Case -19763 To -19757: pinyin = "can "
Case -19756 To -19752: pinyin = "cang "
Case -19751 To -19747: pinyin = "cao "
Case -19746 To -19742: pinyin = "ce "
Case -19741 To -19740: pinyin = "ceng "
Case -19739 To -19729: pinyin = "cha "
Case -19728 To -19726: pinyin = "chai "
Case -19725 To -19716: pinyin = "chan "
Case -19715 To -19541: pinyin = "chang "
Case -19540 To -19532: pinyin = "chao "
Case -19531 To -19526: pinyin = "che "
Case -19525 To -19516: pinyin = "chen "
Case -19515 To -19501: pinyin = "cheng "
Case -19500 To -19485: pinyin = "chi "
Case -19484 To -19480: pinyin = "chong "
Case -19479 To -19468: pinyin = "chou "
Case -19467 To -19290: pinyin = "chu "
Case -19289 To -19289: pinyin = "chuai "
Case -19288 To -19282: pinyin = "chuan "
Case -19281 To -19276: pinyin = "chuang "
Case -19275 To -19271: pinyin = "chui "
Case -19270 To -19264: pinyin = "chun "
Case -19263 To -19262: pinyin = "chuo "
Case -19261 To -19250: pinyin = "ci "
Case -19249 To -19244: pinyin = "cong "
Case -19243 To -19243: pinyin = "cou "
Case -19242 To -19239: pinyin = "cu "
Case -19238 To -19236: pinyin = "cuan "
Case -19235 To -19228: pinyin = "cui "
Case -19227 To -19225: pinyin = "cun "
Case -19224 To -19219: pinyin = "cuo "
Case -19218 To -19213: pinyin = "da "
Case -19212 To -19039: pinyin = "dai "
Case -19038 To -19024: pinyin = "dan "
Case -19023 To -19019: pinyin = "dang "
Case -19018 To -19007: pinyin = "dao "
Case -19006 To -19004: pinyin = "de "
Case -19003 To -18997: pinyin = "deng "
Case -18996 To -18978: pinyin = "di "
Case -18977 To -18962: pinyin = "dian "
Case -18961 To -18953: pinyin = "diao "
Case -18952 To -18784: pinyin = "die "
Case -18783 To -18775: pinyin = "ding "
Case -18774 To -18774: pinyin = "diu "
Case -18773 To -18527: pinyin = "dong "
Case -18526 To -18519: pinyin = "fa "
Case -18518 To -18502: pinyin = "fan "
Case -18501 To -18491: pinyin = "fang "
Case -18490 To -18479: pinyin = "fei "
Case -18478 To -18464: pinyin = "fen "
Case -18463 To -18449: pinyin = "feng "
Case -18448 To -18448: pinyin = "fo "
Case -18447 To -18447: pinyin = "fou "
Case -18446 To -18240: pinyin = "fu "
Case -18239 To -18238: pinyin = "ga "
Case -18237 To -18232: pinyin = "gai "
Case -18231 To -18221: pinyin = "gan "
Case -18220 To -18212: pinyin = "gang "
Case -18211 To -18202: pinyin = "gao "
Case -18201 To -18185: pinyin = "ge "
Case -18184 To -18184: pinyin = "gei "
Case -18183 To -18182: pinyin = "gen "
Case -18181 To -18013: pinyin = "geng "
Case -18012 To -17998: pinyin = "gong "
Case -17997 To -17989: pinyin = "gou "
Case -17988 To -17971: pinyin = "gu "
Case -17970 To -17965: pinyin = "gua "
Case -17964 To -17962: pinyin = "guai "
Case -17961 To -17951: pinyin = "guan "
Case -17950 To -17948: pinyin = "guang "
Case -17947 To -17932: pinyin = "gui "
Case -17931 To -17929: pinyin = "gun "
Case -17928 To -17923: pinyin = "guo "
Case -17922 To -17760: pinyin = "ha "
Case -17759 To -17753: pinyin = "hai "
Case -17752 To -17734: pinyin = "han "
Case -17733 To -17731: pinyin = "hang "
Case -17730 To -17722: pinyin = "hao "
Case -17721 To -17704: pinyin = "he "
Case -17703 To -17702: pinyin = "hei "
Case -17701 To -17698: pinyin = "hen "
Case -17697 To -17693: pinyin = "heng "
Case -17692 To -17684: pinyin = "hong "
Case -17683 To -17677: pinyin = "hou "
Case -17676 To -17497: pinyin = "hu "
Case -17496 To -17488: pinyin = "hua "
Case -17487 To -17483: pinyin = "huai "
Case -17482 To -17469: pinyin = "huan "
Case -17468 To -17455: pinyin = "huang "
Case -17454 To -17434: pinyin = "hui "
Case -17433 To -17428: pinyin = "hun "
Case -17427 To -17418: pinyin = "huo "
Case -17417 To -17203: pinyin = "ji "
Case -17202 To -17186: pinyin = "jia "
Case -17185 To -16984: pinyin = "jian "
Case -16983 To -16971: pinyin = "jiang "
Case -16970 To -16943: pinyin = "jiao "
Case -16942 To -16916: pinyin = "jie "
Case -16915 To -16734: pinyin = "jin "
Case -16733 To -16709: pinyin = "jing "
Case -16708 To -16707: pinyin = "jiong "
Case -16706 To -16690: pinyin = "jiu "
Case -16689 To -16665: pinyin = "ju "
Case -16664 To -16658: pinyin = "juan "
Case -16657 To -16648: pinyin = "jue "
Case -16647 To -16475: pinyin = "jun "
Case -16474 To -16471: pinyin = "ka "
Case -16470 To -16466: pinyin = "kai "
Case -16465 To -16460: pinyin = "kan "
Case -16459 To -16453: pinyin = "kang "
Case -16452 To -16449: pinyin = "kao "
Case -16448 To -16434: pinyin = "ke "
Case -16433 To -16430: pinyin = "ken "
Case -16429 To -16428: pinyin = "keng "
Case -16427 To -16424: pinyin = "kong "
Case -16423 To -16420: pinyin = "kou "
Case -16419 To -16413: pinyin = "ku "
Case -16412 To -16408: pinyin = "kua "
Case -16407 To -16404: pinyin = "kuai "
Case -16403 To -16402: pinyin = "kuan "
Case -16401 To -16394: pinyin = "kuang "
Case -16393 To -16221: pinyin = "kui "
Case -16220 To -16217: pinyin = "kun "
Case -16216 To -16213: pinyin = "kuo "
Case -16212 To -16206: pinyin = "la "
Case -16205 To -16203: pinyin = "lai "
Case -16202 To -16188: pinyin = "lan "
Case -16187 To -16181: pinyin = "lang "
Case -16180 To -16172: pinyin = "lao "
Case -16171 To -16170: pinyin = "le "
Case -16169 To -16159: pinyin = "lei "
Case -16158 To -16156: pinyin = "leng "
Case -16155 To -15960: pinyin = "li "
Case -15959 To -15959: pinyin = "lia "
Case -15958 To -15945: pinyin = "lian "
Case -15944 To -15934: pinyin = "liang "
Case -15933 To -15921: pinyin = "liao "
Case -15920 To -15916: pinyin = "lie "
Case -15915 To -15904: pinyin = "lin "
Case -15903 To -15890: pinyin = "ling "
Case -15889 To -15879: pinyin = "liu "
Case -15878 To -15708: pinyin = "long "
Case -15707 To -15702: pinyin = "lou "
Case -15701 To -15682: pinyin = "lu "
Case -15681 To -15668: pinyin = "lv "
Case -15667 To -15662: pinyin = "luan "
Case -15661 To -15660: pinyin = "lue "
Case -15659 To -15653: pinyin = "lun "
Case -15652 To -15641: pinyin = "luo "
Case -15640 To -15632: pinyin = "ma "
Case -15631 To -15626: pinyin = "mai "
Case -15625 To -15455: pinyin = "man "
Case -15454 To -15449: pinyin = "mang "
Case -15448 To -15437: pinyin = "mao "
Case -15436 To -15436: pinyin = "me "
Case -15435 To -15420: pinyin = "mei "
Case -15419 To -15417: pinyin = "men "
Case -15416 To -15409: pinyin = "meng "
Case -15408 To -15395: pinyin = "mi "
Case -15394 To -15386: pinyin = "mian "
Case -15385 To -15378: pinyin = "miao "
Case -15377 To -15376: pinyin = "mie "
Case -15375 To -15370: pinyin = "min "
Case -15369 To -15364: pinyin = "ming "
Case -15363 To -15363: pinyin = "miu "
Case -15362 To -15184: pinyin = "mo "
Case -15183 To -15181: pinyin = "mou "
Case -15180 To -15166: pinyin = "mu "
Case -15165 To -15159: pinyin = "na "
Case -15158 To -15154: pinyin = "nai "
Case -15153 To -15151: pinyin = "nan "
Case -15150 To -15150: pinyin = "nang "
Case -15149 To -15145: pinyin = "nao "
Case -15144 To -15144: pinyin = "ne "
Case -15143 To -15142: pinyin = "nei "
Case -15141 To -15141: pinyin = "nen "
Case -15140 To -15140: pinyin = "neng "
Case -15139 To -15129: pinyin = "ni "
Case -15128 To -15122: pinyin = "nian "
Case -15121 To -15120: pinyin = "niang "
Case -15119 To -15118: pinyin = "niao "
Case -15117 To -15111: pinyin = "nie "
Case -15110 To -15110: pinyin = "nin "
Case -15109 To -14942: pinyin = "ning "
Case -14941 To -14938: pinyin = "niu "
Case -14937 To -14934: pinyin = "nong "
Case -14933 To -14931: pinyin = "nu "
Case -14930 To -14930: pinyin = "nv "
Case -14929 To -14929: pinyin = "nuan "
Case -14928 To -14927: pinyin = "nue "
Case -14926 To -14923: pinyin = "nuo "
Case -14922 To -14922: pinyin = "o "
Case -14921 To -14915: pinyin = "ou "
Case -14914 To -14909: pinyin = "pa "
Case -14908 To -14903: pinyin = "pai "
Case -14902 To -14895: pinyin = "pan "
Case -14894 To -14890: pinyin = "pang "
Case -14889 To -14883: pinyin = "pao "
Case -14882 To -14874: pinyin = "pei "
Case -14873 To -14872: pinyin = "pen "
Case -14871 To -14858: pinyin = "peng "
Case -14857 To -14679: pinyin = "pi "
Case -14678 To -14675: pinyin = "pian "
Case -14674 To -14671: pinyin = "piao "
Case -14670 To -14669: pinyin = "pie "
Case -14668 To -14664: pinyin = "pin "
Case -14663 To -14655: pinyin = "ping "
Case -14654 To -14646: pinyin = "po "
Case -14645 To -14631: pinyin = "pu "
Case -14630 To -14595: pinyin = "qi "
Case -14594 To -14430: pinyin = "qia "
Case -14429 To -14408: pinyin = "qian "
Case -14407 To -14400: pinyin = "qiang "
Case -14399 To -14385: pinyin = "qiao "
Case -14384 To -14380: pinyin = "qie "
Case -14379 To -14369: pinyin = "qin "
Case -14368 To -14356: pinyin = "qing "
Case -14355 To -14354: pinyin = "qiong "
Case -14353 To -14346: pinyin = "qiu "
Case -14345 To -14171: pinyin = "qu "
Case -14170 To -14160: pinyin = "quan "
Case -14159 To -14152: pinyin = "que "
Case -14151 To -14150: pinyin = "qun "
Case -14149 To -14146: pinyin = "ran "
Case -14145 To -14141: pinyin = "rang "
Case -14140 To -14138: pinyin = "rao "
Case -14137 To -14136: pinyin = "re "
Case -14135 To -14126: pinyin = "ren "
Case -14125 To -14124: pinyin = "reng "
Case -14123 To -14123: pinyin = "ri "
Case -14122 To -14113: pinyin = "rong "
Case -14112 To -14110: pinyin = "rou "
Case -14109 To -14100: pinyin = "ru "
Case -14099 To -14098: pinyin = "ruan "
Case -14097 To -14095: pinyin = "rui "
Case -14094 To -14093: pinyin = "run "
Case -14092 To -14091: pinyin = "ruo "
Case -14090 To -14088: pinyin = "sa "
Case -14087 To -14084: pinyin = "sai "
Case -14083 To -13918: pinyin = "san "
Case -13917 To -13915: pinyin = "sang "
Case -13914 To -13911: pinyin = "sao "
Case -13910 To -13908: pinyin = "se "
Case -13907 To -13907: pinyin = "sen "
Case -13906 To -13906: pinyin = "seng "
Case -13905 To -13897: pinyin = "sha "
Case -13896 To -13895: pinyin = "shai "
Case -13894 To -13879: pinyin = "shan "
Case -13878 To -13871: pinyin = "shang "
Case -13870 To -13860: pinyin = "shao "
Case -13859 To -13848: pinyin = "she "
Case -13847 To -13832: pinyin = "shen "
Case -13831 To -13659: pinyin = "sheng "
Case -13658 To -13612: pinyin = "shi "
Case -13611 To -13602: pinyin = "shou "
Case -13601 To -13407: pinyin = "shu "
Case -13406 To -13405: pinyin = "shua "
Case -13404 To -13401: pinyin = "shuai "
Case -13400 To -13399: pinyin = "shuan "
Case -13398 To -13396: pinyin = "shuang "
Case -13395 To -13392: pinyin = "shui "
Case -13391 To -13388: pinyin = "shun "
Case -13387 To -13384: pinyin = "shuo "
Case -13383 To -13368: pinyin = "si "
Case -13367 To -13360: pinyin = "song "
Case -13359 To -13357: pinyin = "sou "
Case -13356 To -13344: pinyin = "su "
Case -13343 To -13341: pinyin = "suan "
Case -13340 To -13330: pinyin = "sui "
Case -13329 To -13327: pinyin = "sun "
Case -13326 To -13319: pinyin = "suo "
Case -13318 To -13148: pinyin = "ta "
Case -13147 To -13139: pinyin = "tai "
Case -13138 To -13121: pinyin = "tan "
Case -13120 To -13108: pinyin = "tang "
Case -13107 To -13097: pinyin = "tao "
Case -13096 To -13096: pinyin = "te "
Case -13095 To -13092: pinyin = "teng "
Case -13091 To -13077: pinyin = "ti "
Case -13076 To -13069: pinyin = "tian "
Case -13068 To -13064: pinyin = "tiao "
Case -13063 To -13061: pinyin = "tie "
Case -13060 To -12889: pinyin = "ting "
Case -12888 To -12876: pinyin = "tong "
Case -12875 To -12872: pinyin = "tou "
Case -12871 To -12861: pinyin = "tu "
Case -12860 To -12859: pinyin = "tuan "
Case -12858 To -12853: pinyin = "tui "
Case -12852 To -12850: pinyin = "tun "
Case -12849 To -12839: pinyin = "tuo "
Case -12838 To -12832: pinyin = "wa "
Case -12831 To -12830: pinyin = "wai "
Case -12829 To -12813: pinyin = "wan "
Case -12812 To -12803: pinyin = "wang "
Case -12802 To -12608: pinyin = "wei "
Case -12607 To -12598: pinyin = "wen "
Case -12597 To -12595: pinyin = "weng "
Case -12594 To -12586: pinyin = "wo "
Case -12585 To -12557: pinyin = "wu "
Case -12556 To -12360: pinyin = "xi "
Case -12359 To -12347: pinyin = "xia "
Case -12346 To -12321: pinyin = "xian "
Case -12320 To -12301: pinyin = "xiang "
Case -12300 To -12121: pinyin = "xiao "
Case -12120 To -12100: pinyin = "xie "
Case -12099 To -12090: pinyin = "xin "
Case -12089 To -12075: pinyin = "xing "
Case -12074 To -12068: pinyin = "xiong "
Case -12067 To -12059: pinyin = "xiu "
Case -12058 To -12040: pinyin = "xu "
Case -12039 To -11868: pinyin = "xuan "
Case -11867 To -11862: pinyin = "xue "
Case -11861 To -11848: pinyin = "xun "
Case -11847 To -11832: pinyin = "ya "
Case -11831 To -11799: pinyin = "yan "
Case -11798 To -11782: pinyin = "yang "
Case -11781 To -11605: pinyin = "yao "
Case -11604 To -11590: pinyin = "ye "
Case -11589 To -11537: pinyin = "yi "
Case -11536 To -11359: pinyin = "yin "
Case -11358 To -11341: pinyin = "ying "
Case -11340 To -11340: pinyin = "yo "
Case -11339 To -11325: pinyin = "yong "
Case -11324 To -11304: pinyin = "you "
Case -11303 To -11098: pinyin = "yu "
Case -11097 To -11078: pinyin = "yuan "
Case -11077 To -11068: pinyin = "yue "
Case -11067 To -11056: pinyin = "yun "
Case -11055 To -11053: pinyin = "za "
Case -11052 To -11046: pinyin = "zai "
Case -11045 To -11042: pinyin = "zan "
Case -11041 To -11039: pinyin = "zang "
Case -11038 To -11025: pinyin = "zao "
Case -11024 To -11021: pinyin = "ze "
Case -11020 To -11020: pinyin = "zei "
Case -11019 To -11019: pinyin = "zen "
Case -11018 To -11015: pinyin = "zeng "
Case -11014 To -10839: pinyin = "zha "
Case -10838 To -10833: pinyin = "zhai "
Case -10832 To -10816: pinyin = "zhan "
Case -10815 To -10801: pinyin = "zhang "
Case -10800 To -10791: pinyin = "zhao "
Case -10790 To -10781: pinyin = "zhe "
Case -10780 To -10765: pinyin = "zhen "
Case -10764 To -10588: pinyin = "zheng "
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
1.啟動(dòng)Excel,打開相應(yīng)的工作表。 2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài)。 3.執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編輯狀態(tài)。 4.將代碼輸入其中。
復(fù)制完成后,在鍵盤上按住ALT+Q組合鍵,關(guān)閉Visual Basic編輯窗口,返回Excel編輯狀態(tài)。
如圖,如果需要將轉(zhuǎn)換后的拼音放在B列,則在B3單元格公式欄輸入公式:=getpy(A3),這里的A3,是指源頭單元格的坐標(biāo)。
單擊回車鍵,返回結(jié)果。
最后,如果需要將其他名字也轉(zhuǎn)換為拼音,則可直接選中B3單元格,下拉填充柄,得到其他轉(zhuǎn)換后的拼音。如此,便可將漢字批量轉(zhuǎn)換為拼音啦。
擴(kuò)展閱讀,以下內(nèi)容您可能還感興趣。
Excel 如何設(shè)置 把漢字變成 拼音的格式
用自定義函zhidao數(shù)與EXCEL函數(shù)結(jié)內(nèi)合,如圖,如附件容。記得加載宏;
=SUBSTITUTE(SUBSTITUTE(Getpy(A1),MID(Getpy(A1),1,FIND(" ",Getpy(A1))),"")," ","") & " " & MID(Getpy(A1),1,FIND(" ",Getpy(A1)))1、ALT+F11會(huì)看到代碼
2、把代碼全部復(fù)制到你的文件中的模塊中(ATL+F11插入模塊);
3、輸入
=SUBSTITUTE(SUBSTITUTE(Getpy(A1),MID(Getpy(A1),1,FIND(" ",Getpy(A1))),"")," ","") & " " & MID(Getpy(A1),1,FIND(" ",Getpy(A1)))A1就是你要處理的單元格。
如果你實(shí)在怕麻煩,就把你要處理的東西復(fù)制到我給給你文件中。直接輸入上面公式就可以了。追問感謝您的回答, 但是遇到一個(gè)問題 ,
例如 蘇有錢 我想要的是 Youqian SU 姓部分都是大寫的、 這樣能實(shí)現(xiàn)嗎?追答=SUBSTITUTE(SUBSTITUTE(Getpy(A1),MID(Getpy(A1),1,FIND(" ",Getpy(A1))),"")," ","") & " " & MID(UPPER(Getpy(A1)),1,FIND(" ",Getpy(A1)))
對(duì)了,剛說錯(cuò)了點(diǎn)(因?yàn)槟氵@個(gè)貼子太久了,有點(diǎn)忘了),直接打開我發(fā)給你的附件,就可以用公式了。不用復(fù)制代碼。
excel 如何把“漢字”轉(zhuǎn)換為“拼音首字母”?
1.啟動(dòng)Excel,打開相應(yīng)的工作表。
2.執(zhí)行“工具→宏→Visual Basic編輯器”命令(或者直接按“Alt+F11”組合鍵),進(jìn)入Visual Basic編輯狀態(tài)。
3.執(zhí)行“插入→模塊”命令,插入一個(gè)新模塊。再雙擊插入的模塊,進(jìn)入模塊代碼編輯狀態(tài)。
4.將代碼輸入其中。代碼如下:
Function getpychar(char)
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
'逐個(gè)取ASC碼
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy & getpychar(Mid(str, i, 1))
Next i
End Function
5.代碼輸入完成后,關(guān)閉e799bee5baa6e78988e69d8331333433623730Visual Basic編輯窗口,返回Excel編輯狀態(tài)。
6.自定義函數(shù)就可以用了。如:選中A2單元格,輸入公式:=getpy(A2)。
excel 如何把”漢字“轉(zhuǎn)換為”拼音首字母“,切記為”拼音首字母“?。。。????
以Excel2007為例:
1、打開相應(yīng)的Excel文件,按“Alt+F11”組合鍵,彈出“Visual Basic編輯器”如下圖:
2、鼠標(biāo)點(diǎn)擊“Visual Basic編輯器”菜單欄的“插入”選項(xiàng),選擇下拉列表里的“模塊”,插入“模塊”,如下圖:
3、將下面的代碼復(fù)制粘貼到里面:
Function getpychar(char)
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 '如果不是中文,則不處理e799bee5baa6e78988e69d8331333363353832
getpychar = char
End If
End Function
'逐個(gè)取ASC碼
Function getpy(str)
For i = 1 To Len(str)
getpy = getpy & getpychar(Mid(str, i, 1))
Next i
End Function
然后關(guān)閉Visual Basic編輯窗口,返回Excel編輯狀態(tài)。分別如下圖:
4、選中B2單元格,輸入公式"=getpy(a1)",鼠標(biāo)移到B2單元格右下角,下拉填充公式即可,如下圖:
如何在excel中把拼音轉(zhuǎn)換成漢子
可以但用百起來很復(fù)雜累人,也不可能在這里說明白,只在這里說的一度下簡(jiǎn)單的無理,以其中一種方法為例。
利用VLOOKUP這類的函數(shù),在次列把本知列單元格內(nèi)拼音轉(zhuǎn)換成漢字。
首先別設(shè)一張引用源數(shù)據(jù)表道,A列是拼間 B列為漢字
通函數(shù)依引用源數(shù)據(jù)表A列為條件,反回B列值
這活很版累*,如果你想用表格實(shí)現(xiàn)一些專用轉(zhuǎn)件的功能實(shí)在是一件累人且效率不高的活,不建議這樣干追問有什么軟件可以用
在wps表格里如何把漢字轉(zhuǎn)換成拼音
1、首先選中姓名單元格區(qū)域,點(diǎn)擊右上角的工具箱。
2、然后抄點(diǎn)擊頁(yè)面上方的拼音筆畫。
3、點(diǎn)擊打開列襲表中的漢字轉(zhuǎn)拼音。
4、接著點(diǎn)擊頁(yè)面中間的確定按鈕。
5、選擇將結(jié)果保知存的位置點(diǎn)擊確定。
6、最后就可以看到所有的漢字都轉(zhuǎn)換成了道拼音。
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:0731-84117792 E-MAIL:11247931@qq.com