Excel2016通过宏生成拼音码

  • 一:视图---->宏---->录制宏

Excel2016通过宏生成拼音码

  • 二:试图---->宏---->查看宏

Excel2016通过宏生成拼音码

  • 三:点击编辑,输入如下代码片段,点击保存,并选择是
Function pinyin(p As String) As String

i = Asc(p)

Select Case i

Case - To -: pinyin = "A"

Case - To -: pinyin = "B"

Case - To -: pinyin = "C"

Case - To -: pinyin = "D"

Case - To -: pinyin = "E"

Case - To -: pinyin = "F"

Case - To -: pinyin = "G"

Case - To -: pinyin = "H"

Case - To -: pinyin = "J"

Case - To -: pinyin = "K"

Case - To -: pinyin = "L"

Case - To -: pinyin = "M"

Case - To -: pinyin = "N"

Case - To -: pinyin = "O"

Case - To -: pinyin = "P"

Case - To -: pinyin = "Q"

Case - To -: pinyin = "R"

Case - To -: pinyin = "S"

Case - To -: pinyin = "T"

Case - To -: pinyin = "W"

Case - To -: pinyin = "X"

Case - To -: pinyin = "Y"

Case - To -: pinyin = "Z"

Case Else: pinyin = p

End Select

End Function

Function getpy(str)

For i =  To Len(str)

getpy = getpy & pinyin(Mid(str, i, ))

Next i

End Function

Excel2016通过宏生成拼音码

  • 四:回到excel,鼠标定位到“拼音码”列第一行(C2单元格)。在函数框中输入=getpy(B2),(调用自定义函数,获取B2单元格中汉字内容首字母)回车,可以看到获取到B2单元格中内容的首字母

Excel2016通过宏生成拼音码

  • 五:鼠标定位到单元格C2右下角,光标变成黑色十字,按住鼠标左键一直往下拉。获取全部内容的拼音码。

Excel2016通过宏生成拼音码

上一篇:touch-action 解决移动端300ms延迟问题


下一篇:【HMTL】3D标签球