getpy函數用不了?
getpy函數用不了是因為Excel沒有加入成功。
推薦教學:excel教學
excel加入getpy函數的方法:
1、開啟Excel,同時按下Alt F11鍵,開啟VBE介面,點選圖片中所示的左上角空白處,選擇「插入“,」模組「;
#2、此時,就插入了一個模組,後面的程式碼就要放到這個模組中,確保右側空白區域是模組程式碼的編輯區(最保險的做法是雙擊模組),然後執行下一步;
3、將下面的程式碼全部複製貼上到空白區域;
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
#4、關閉這個新介面,回傳Excel,然後就可以像Excel自帶的函數一樣使用這個自訂的Getpy函數了,它只有一個參數,參數可以直接指定儲存格,也可以直接輸入字元。
以上是getpy函數用不了怎麼辦?的詳細內容。更多資訊請關注PHP中文網其他相關文章!