瀏覽量:49次
步驟如下:
1.ALt+F11,打開VBE界面,左上角空白處,點擊右鍵,插入模塊
2.在模塊的空白處,粘貼上如下代碼:
Function pinyin(p As String) As String i = Asc(p) Select Case i Case -20319 To -20284: pinyin = "A" Case -20283 To -19776: pinyin = "B" Case -19775 To -19219: pinyin = "C" Case -19218 To -18711: pinyin = "D" Case -18710 To -18527: pinyin = "E" Case -18526 To -18240: pinyin = "F" Case -18239 To -17923: pinyin = "G" Case -17922 To -17418: pinyin = "H" Case -17417 To -16475: pinyin = "J" Case -16474 To -16213: pinyin = "K" Case -16212 To -15641: pinyin = "L" Case -15640 To -15166: pinyin = "M" Case -15165 To -14923: pinyin = "N" Case -14922 To -14915: pinyin = "O" Case -14914 To -14631: pinyin = "P" Case -14630 To -14150: pinyin = "Q" Case -14149 To -14091: pinyin = "R" Case -14090 To -13319: pinyin = "S" Case -13318 To -12839: pinyin = "T" Case -12838 To -12557: pinyin = "W" Case -12556 To -11848: pinyin = "X" Case -11847 To -11056: pinyin = "Y" Case -11055 To -2050: pinyin = "Z" 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
3.關(guān)閉VBE界面,返回Excel,就可以像正常函數(shù)一樣使用自定義的Getpy函數(shù),來取得文本的拼音縮寫了
[聲明]本網(wǎng)轉(zhuǎn)載網(wǎng)絡(luò)媒體稿件是為了傳播更多的信息,此類稿件不代表本網(wǎng)觀點,本網(wǎng)不承擔此類稿件侵權(quán)行為的連帶責任。故此,如果您發(fā)現(xiàn)本網(wǎng)站的內(nèi)容侵犯了您的版權(quán),請您的相關(guān)內(nèi)容發(fā)至此郵箱【779898168@qq.com】,我們在確認后,會立即刪除,保證您的版權(quán)。
官網(wǎng)優(yōu)化
整站優(yōu)化
渠道代理
400-655-5776