按Alt+F11進入Visual Basic的編輯狀態;
執行“插入→模塊”命令,插入壹個新模塊。雙擊插入的模塊,進入模塊編碼編輯狀態;
輸入宏代碼:
函數拼音(p為字符串)為字符串
i = Asc(p)
選擇案例壹
案例-20319至-20318:拼音= "a "
案例-20317至-20305:拼音= "ai "
案例-20304至-20296:拼音= "安"
Case -20295 To -20293: pinyin = "ang "
案例-20292至-20284:拼音= "ao "
案例-20283至-20266:拼音= "巴"
案例-20265 To -20258:拼音= "白"
Case -20257 To -20243: pinyin = "ban "
case-20242 To-20231:pinyin = " bang "
案例-20230至-20052:拼音= "鮑"
Case -20051 To -20037:拼音= "北"
Case -20036 To -20033: pinyin = "ben "
case-20032 To-20027:pinyin = " beng "
Case -20026 To -20003: pinyin = "bi "
case-20002 To-19991:pinyin = " bian "
案例-19990轉-19987:拼音= "標"
案例-19986轉-19983:拼音= "bie "
案例-19982轉-19977:拼音= "bin "
案例-19976轉-19806:拼音= "bing "
案例-19805轉-19785:拼音= "bo "
案例-19784轉-19776:拼音= "bu "
案例-19775至-19775:拼音= "ca "
案例-19774轉-19764:拼音= "蔡"
案例-19763轉-19757:拼音= "可以"
案例-19756轉-19752:拼音=“蒼”
案例-19751至-19747:拼音= "曹"
案例-19746轉-19742:拼音= "ce "
案例-19741至-19740:拼音= "曾"
case-19739 To-19729:pinyin = " cha "
案例-19728轉-19726:拼音= "柴"
案例-19725轉-19716:pinyin = " chan "
case-19715 To-19541:拼音= "chang "
案例-19540轉-19532:拼音= "chao "
Case -19531到-19526: pinyin = "che "
案例-19525轉-19516:拼音= "陳"
case-19515 To-19501:拼音= "成"
案例-19500轉-19485:拼音= "池"
案例-19484轉-19480:拼音= "chong "
案例-19479轉-19468:拼音= "chou "
案例-19467轉-19290:拼音= "chu "
案例-19289轉-19289:拼音= "嘬"
案例-19288轉-19282:拼音= "川"
案例-19281到-19276:拼音= "創"
案例-19275轉-19271:pinyin = " chui "
案例-19270轉-19264:拼音= "chun "
案例-19263轉-19262: pinyin = "chuo "
案例-19261到-19250:拼音= "ci "
案例-19249轉-19244:拼音=“叢”
案例-19243至-19243:拼音= "cou "
案例-19242至-19239:拼音= "cu "
案例-19238轉-19236:拼音= "cuan "
案例-19235轉-19228:拼音= "崔"
案例-19227轉-19225:拼音= "寸"
案例-19224轉-19219:拼音= "cuo "
案例-19218轉-19213:拼音= "da "
案例-19212至-19039:拼音= "戴"
案例-19038轉-19024:拼音= "丹"
案例-19023轉-19019:拼音= "dang "
案例-19018轉-19007:拼音= "道"
案例-19006轉-19004:拼音= "de "
案例-19003至-18997:拼音= "鄧"
案例-18996轉-18978:拼音= "di "
案例-18977轉-18962:拼音= "點"
Case -18961到-18953: pinyin = "diao "
案例-18952轉-18784:拼音= "die "
案例-18783轉-18775:拼音=“丁”
案例-18774轉-18774:拼音= "diu "
案例-18773轉-18527:拼音= "dong "
案例-18526轉-18519:拼音= "fa "
案例-18518轉-18502:拼音= "fan "
案例-18501至-18491:拼音= "方"
案例-18490轉-18479:拼音= "費"
案例-18478轉-18464:拼音=“分”
案例-18463轉-18449:拼音= "馮"
案例-18448轉-18448:拼音= "fo "
案例-18447至-18447:拼音= "fou "
Case -18446轉-18240:拼音= "fu "
案例-18239至-18238:拼音= "ga "
案例-18237轉-18232:拼音= "gai "
Case -18231轉-18221:拼音= "甘"
案例-18220轉-18212:拼音= "gang "
案例-18211到-18202:拼音= "高"
案例-18201轉-18185:拼音= "葛"
案例-18184轉-18184:拼音= "gei "
案例-18183轉-18182:拼音= "gen "
Case -18181轉-18013:拼音= "耿"
案例-18012轉-17998:拼音= "龔"
案例-17997轉-17989:拼音= "gou "
案例-17988轉-17971:拼音= "顧"
案例-17970至-17965:拼音= "gua "
案例-17964轉-17962: pinyin = "guai "
Case -17961到-17951:拼音= "關"
案例-17950轉-17948:拼音= "廣"
案例-17947至-17932:拼音= "gui "
案例-17931轉-17929:拼音= "gun "
案例-17928轉-17923:拼音= "郭"
案例-17922轉-17760:拼音= "ha "
案例-17759轉-17753:拼音= "海"
Case -17752 To -17734:拼音= "han "
案例-17733轉-17731:拼音= "hang "
案例-17730轉-17722:拼音= "郝"
案例-17721到-17704:拼音= "何"
案例-17703轉-17702:拼音= "黑"
案例-17701到-17698:拼音= "hen "
案例-17697轉-17693:拼音=“恒”
案例-17692轉-17684:拼音= "hong "
案例-17683轉-17677:拼音= "侯"
案例-17676轉-17497:拼音= "胡"
案例-17496轉-17488:拼音= "華"
案例-17487轉-17483:拼音=“淮”
案例-17482轉-17469:拼音=“歡”
案例-17468轉-17455:拼音= "黃"
案例-17454轉-17434:拼音=“惠”
案例-17433至-17428:拼音= "hun "
案例-17427轉-17418:拼音= "霍"
案例-17417至-17203:拼音= "冀"
案例-17202轉-17186:拼音= "賈"
案例-17185轉-16984:拼音= "jian "
案例-16983轉-16971:拼音= "江"
案例-16970轉-16943:拼音= "焦"
案例-16942轉-16916:拼音= "jie "
案例-16915轉-16734:拼音= "金"
案例-16733轉-16709:拼音= "jing "
案例-16708轉-16707:拼音= "jiong "
案例-16706轉-16690:拼音= "就"
Case -16689轉-16665: pinyin = "ju "
案例-16664轉-16658:拼音= "juan "
案例-16657轉-16648:拼音=“覺”
案例-16647轉-16475:拼音= "jun "
case-16474 To-16471:pinyin = " ka "
案例-16470轉-16466:拼音= "kai "
案例-16465轉-16460:拼音= "kan "
案例-16459轉-16453:拼音= "康"
案例-16452轉-16449:拼音= "kao "
Case -16448 To -16434:拼音= "ke "
案例-16433轉-16430:拼音= "ken "
案例-16429轉-16428:拼音= "keng "
案例-16427至-16424:拼音= "孔"
案例-16423轉-16420:拼音= "kou "
案例-16419轉-16413:拼音= "ku "
案例-16412轉-16408:拼音= "kua "
案例-16407轉-16404:拼音= "快"
案例-16403轉-16402:拼音= "kuan "
案例-16401到-16394:拼音= "匡"
案例-16393轉-16221:拼音= "kui "
案例-16220轉-16217:拼音= "kun "
案例-16216轉-16213:拼音= "kuo "
案例-16212轉-16206:拼音= "la "
案例-16205轉-16203:拼音= "賴"
案例-16202轉-16188:拼音= "蘭"
案例-16187轉-16181:拼音= "郎"
案例-16180轉-16172:拼音= "lao "
Case -16171到-16170: pinyin = "le "
案例-16169轉-16159:拼音= "雷"
案例-16158轉-16156:拼音= "冷"
案例-16155轉-15960:拼音= "李"
案例-15959至-15959:拼音= "lia "
案例-15958至-15945:拼音= "連"
案例-15944至-15934:拼音= "梁"
案例-15933轉-15921:拼音= "廖"
案例-15920轉-15916:拼音= "lie "
案例-15915至-15904:拼音= "林"
案例-15903轉-15890:拼音= "淩"
案例-15889轉-15879:拼音= "劉"
案例-15878轉-15708:拼音= "long "
案例-15707轉-15702:拼音= "樓"
案例-15701到-15682:拼音= "陸"
案例-15681到-15668:拼音= "lv "
案例-15667轉-15662:拼音= "欒"
案例-15661到-15660:拼音= "lue "
case-15659 To-15653:pinyin = " LUN "
案例-15652轉-15641:拼音= "羅"
案例-15640至-15632:拼音= "馬"
案例-15631到-15626:拼音= "mai "
案例-15625轉-15455:拼音= "man "
案例-15454轉-15449:拼音= "mang "
Case -15448 To -15437:拼音= "mao "
案例-15436轉-15436:拼音= "me "
案例-15435轉-15420:拼音= "mei "
案例-15419轉-15417:拼音= "men "
案例-15416至-15409:拼音= "孟"
Case -15408 To -15395:拼音= "mi "
案例-15394轉-15386:拼音= "mian "
案例-15385轉-15378:拼音= "苗"
案例-15377轉-15376:拼音= "mie "
case-15375 To-15370:pinyin = " min "
案例-15369轉-15364:拼音=“明”
案例-15363轉-15363:拼音= "miu "
案例-15362轉-15184:拼音= "mo "
案例-15183轉-15181:拼音= "牟"
案例-15180轉-15166:拼音= "mu "
case-15165 To-15159:拼音= "na "
案例-15158轉-15154:拼音= "nai "
case-15153 To-15151:pinyin = " nan "
case-15150 To-15150:pinyin = " nang "
案例-15149轉-15145:拼音= "nao "
案例-15144轉-15144:拼音= "ne "
案例-15143轉-15142:拼音= "nei "
案例-15141到-15141:pinyin = " nen "
案例-15140轉-15140:拼音= "能"
案例-15139轉-15129:拼音= "ni "
case-15128 To-15122:拼音= "年"
案例-15121到-15120:拼音=“娘”
case-15119 To-15118:pinyin = " niao "
案例-15117轉-15111:拼音= "聶"
案例-15110到-15110:拼音= "nin "
案例-15109轉-14942:拼音= "寧"
案例-14941到-14938:拼音= "牛"
案例-14937轉-14934:拼音=“農”
case-14933 To-14931:pinyin = " nu "
case-14930 To-14930:pinyin = " NV "
案例-14929轉-14929:拼音= "nuan "
案例-14928轉-14927:拼音= "nue "
案例-14926轉-14923:拼音=“諾”
案例-14922到-14922:拼音= "o "
Case -14921到-14915:拼音= "ou "
案例-14914至-14909:拼音= "pa "
案例-14908轉-14903:拼音= "pai "
案例-14902至-14895:拼音= "pan "
案例-14894轉-14890:拼音= "龐"
案例-14889至-14883:拼音= "pao "
案例-14882轉-14874:拼音= "pei "
Case -14873轉-14872:拼音= "鋼筆"
案例-14871至-14858:拼音= "彭"
案例-14857到-14679:拼音= "pi "
案例-14678至-14675:拼音= "pian "
案例-14674轉-14671:pinyin = " Piao "
案例-14670轉-14669:拼音= "pie "
案例-14668至-14664:拼音= "pin "
案例-14663轉-14655:拼音= "平"
案例-14654轉-14646:拼音= "po "
case-14645 To-14631:pinyin = " pu "
案例-14630轉-14595:拼音= "齊"
案例-14594轉-14430:拼音= "qia "
案例-14429轉-14408:拼音= "錢"
案例-14407轉-14400:拼音= "qiang "
案例-14399轉-14385:拼音= "喬"
案例-14384轉-14380:拼音= "qie "
案例-14379轉-14369:拼音= "秦"
Case -14368轉-14356:拼音= "qing "
案例-14355至-14354:拼音= " qiong "
案例-14353轉-14346:拼音= "邱"
case-14345 To-14171:拼音= "曲"
案例-14170轉-14160:拼音= "quan "
case-14159 To-14152:pinyin = " que "
case-14151 To-14150:pinyin = " qun "
案例-14149轉-14146:拼音= "冉"
case-14145 To-14141:pinyin = " rang "
案例-14140轉-14138:拼音= "饒"
case-14137 To-14136:pinyin = " re "
案例-14135轉-14126:拼音= "任"
case-14125 To-14124:pinyin = " reng "
case-14123 To-14123:pinyin = " ri "
案例-14122轉-14113:拼音= "榮"
case-14112 To-14110:pinyin = " rou "
case-14109 To-14100:pinyin = " ru "
案例-14099至-14098:拼音= "阮"
案例-14097轉-14095:拼音= "rui "
案例-14094轉-14093:拼音= "run "
Case -14092轉-14091: pinyin = "ruo "
案例-14090至-14088:拼音= "sa "
案例-14087轉-14084:拼音= "sai "
case-14083 To-13918:pinyin = " San "
案例-13917至-13915:拼音= "桑"
案例-13914轉-13911:pinyin = " Sao "
案例-13910至-13908:拼音= "se "
案例-13907轉-13907:拼音= "sen "
案例-13906至-13906:拼音= "seng "
案例-13905至-13897:拼音= "sha "
案例-13896轉-13895:拼音= "shai "
案例-13894轉-13879:拼音= "山"
案例-13878轉-13871:拼音= "尚"
案例-13870轉-13860:拼音= "邵"
案例-13859轉-13848:拼音= "she "
案例-13847轉-13832:拼音= "沈"
Case -13831到-13659:拼音= "盛"
案例-13658至-13612:拼音= "施"
案例-13611到-13602:拼音= "shou "
案例-13601到-13407:拼音= "舒"
案例-13406轉-13405:拼音= "shua "
案例-13404轉-13401:拼音= "帥"
案例-13400轉-13399:拼音= "shuan "
案例-13398轉-13396:拼音= "雙"
案例-13395轉-13392:拼音= "水"
案例-13391轉-13388:拼音= "順"
案例-13387轉-13384:拼音= "說"
案例-13383至-13368:拼音= "si "
案例-13367轉-13360:拼音= "宋"
case-13359 To-13357:pinyin = " sou "
案例-13356轉-13344:拼音= "蘇"
案例-13343轉-13341:拼音= "suan "
案例-13340轉-13330:拼音= "穗"
案例-13329轉-13327:拼音= "孫"
案例-13326轉-13319:拼音= "索"
案例-13318轉-13148:拼音= "ta "
案例-13147轉-13139:拼音= "tai "
case-13138 To-13121:pinyin = " tan "
案例-13120轉-13108:拼音= "唐"
案例-13107轉-13097:拼音= "陶"
案例-13096轉-13096:拼音= "te "
案例-13095轉-13092:拼音= "滕"
Case -13091到-13077: pinyin = "ti "
案例-13076轉-13069:拼音= "田"
案例-13068至-13064:拼音= "條"
case-13063 To-13061:pinyin = " tie "
案例-13060轉-12889:拼音= "ting "
案例-12888轉-12876:拼音= "童"
案例-12875轉-12872:拼音= "tou "
Case -12871到-12861: pinyin = "tu "
案例-12860轉-12859:拼音= "tuan "
案例-12858轉-12853:拼音= "tui "
案例-12852至-12850:拼音= "tun "
案例-12849轉-12839:拼音= "陀"
案例-12838至-12832:拼音= "wa "
案例-12831轉-12830:拼音= "wai "
案例-12829轉-12813:拼音= "萬"
案例-12812至-12803:拼音= "王"
案例-12802轉-12608:拼音= "魏"
案例-12607轉-12598:拼音= "文"
案例-12597轉-12595:拼音= "翁"
案例-12594轉-12586:拼音= "wo "
案例-12585轉-12557:拼音= "吳"
案例-12556轉-12360:拼音= "xi "
案例-12359轉-12347:拼音= "夏"
案例-12346轉-12321:拼音= "xian "
case-12320 To-12301:拼音= "向"
案例-12300轉-12121:拼音= "肖"
案例-12120轉-12100:拼音= "謝"
案例-12099轉-12090:拼音= "xin "
案例-12089轉-12075:拼音= "xing "
案例-12074轉-12068:拼音= "熊"
案例-12067轉-12059:拼音= "秀"
案例-12058轉-12040:拼音= "徐"
案例-12039轉-11868:拼音= "宣"
案例-11867轉-11862:拼音= "薛"
案例-11861轉-11848:拼音= "xun "
案例-11847轉-11832:拼音= "ya "
案例-11831轉-11799:拼音= "yan "
案例-11798轉-11782:拼音= "楊"
案例-11781轉-11605:拼音= "姚"
案例-11604轉-11590:拼音= "葉"
case-11589 To-11537:拼音= "yi "
Case -11536轉-11359:拼音= "yin "
案例-11358轉-11341:拼音= "ying "
案例-11340轉-11340:拼音= "yo "
Case -11339轉-11325:拼音= "yong "
案例-11324轉-11304:拼音=“妳”
案例-11303轉-11098:拼音= "於"
案例-11097轉-11078:拼音= "元"
案例-11077轉-11068:拼音= "嶽"
案例-11067轉-11056:拼音= "雲"
案例-11055轉-11053:拼音= "za "
案例-11052轉-11046:拼音= "zai "
案例-11045轉-11042:拼音= "zan "
Case -11041到-11039:拼音= "臧"
case-11038 To-11025:拼音= "zao "
案例-11024轉-11021:拼音= "ze "
案例-11020轉-11020: pinyin = "zei "
案例-11019轉-11019:拼音= "禪"
case-11018 To-11015:拼音= "曾"
case-11014 To-10839:拼音= "zha "
Case -10838 To -10833:拼音= "翟"
案例-10832轉-10816:拼音= "詹"
case-10815 To-10801:拼音= "張"
案例-10800轉-10791:拼音= "趙"
case-10790 To-10781:pinyin = " zhe "
案例-10780轉-10765:拼音= "zhen "
案例-10764轉-10588:拼音= "鄭"
案例-10587轉-10545:拼音= "zhi "
Case -10544 To -10534:拼音= "鐘"
案例-10533至-10520:拼音= "周"
案例-10519至-10332:拼音= "朱"
Case -10331到-10330: pinyin = "zhua "
Case -10329 To -10329:拼音= "zhuai "
Case -10328 To -10323:拼音= "zhuan "
案例-10322轉-10316:拼音= "莊"
case-10315 To-10310:pinyin = " zhui "
案例-10309至-10308:拼音= "準"
案例-10307轉-10297:拼音= "卓"
案例-10296轉-10282:拼音= "zi "
案例-10281到-10275:拼音= "宗"
案例-10274轉-10271:拼音= "鄒"
案例-10270轉-10263:拼音= "zu "
案例-10262轉-10261:拼音= "安祖"
案例-10260轉-10257:拼音= "zui "
案例-10256轉-10255:拼音= "zun "
案例-10254轉-10254:拼音= "左"
其他情況:拼音= p
結束選擇
結束功能
函數getpy(str)
For i = 1到Len(str)
getpy = getpy & amp拼音(Mid(str,I,1))
接下來我
結束功能
關閉Visual Basic編輯窗口,返回Excel編輯狀態。
選擇需要將轉換後的拼音放入哪壹列,例如D列的第二個單元格,然後輸入公式:=getpy(D2)。
不能轉換單個漢字。手動刪除漢字,輸入拼音。
刪除拼音之間的空格。刪除了空格的拼音放在e列中。如果此數據原來在單元格D2中,而刪除了空格的拼音放在單元格E2中,則在單元格E2中輸入=SUBSTITUTE(D2,""," ")。
九
如果以上經驗對妳有幫助,請在左下角給我點個贊。謝謝大家!