久久综合九色综合97婷婷-美女视频黄频a免费-精品日本一区二区三区在线观看-日韩中文无码有码免费视频-亚洲中文字幕无码专区-扒开双腿疯狂进出爽爽爽动态照片-国产乱理伦片在线观看夜-高清极品美女毛茸茸-欧美寡妇性猛交XXX-国产亚洲精品99在线播放-日韩美女毛片又爽又大毛片,99久久久无码国产精品9,国产成a人片在线观看视频下载,欧美疯狂xxxx吞精视频

有趣生活

當前位置:首頁>知識>excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)

發布時間:2024-01-23閱讀(11)

導讀用Excel收集統計個人信息時,會遇見各種各樣的問題。例如:我們需要將中文姓名轉換成首字母拼音的形式,這時候該怎么操作呢?你還在一個一個的輸入嗎?這樣太麻煩....

用Excel收集統計個人信息時,會遇見各種各樣的問題。例如:我們需要將中文姓名轉換成首字母拼音的形式,這時候該怎么操作呢?

你還在一個一個的輸入嗎?這樣太麻煩了,接下來讓我們使用VBA,快速將中文轉換成拼音首字母的形式,簡單便捷,快來試試吧!

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)(1)

打開Microsoft Excel工作簿,如果Excel文件后綴名是“xlsx”,請先將Excel文檔另存為“xls”或者“xlsm”類型。

右鍵單擊Sheet1工作表,選中右鍵菜單中的查看代碼。

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)(2)

在Microsoft Visual Basic for Applications窗口中,右鍵單擊工程資源管理器窗口中的空白位置,將鼠標指針移動至插入,選中模塊。

接著將以下代碼復制粘貼至模塊1的代碼窗口中,點擊保存后退出Visual Basic編輯器。

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)(3)

代碼區域

Function Getpychar(char)

temp = 65536 Asc(char)

If (temp >= 45217 And temp <= 45252) Then

Getpychar = "A"

ElseIf (temp >= 45253 And temp <= 45760) Then

Getpychar = "B"

ElseIf (temp >= 45761 And temp <= 46317) Then

Getpychar = "C"

ElseIf (temp >= 46318 And temp <= 46825) Then

Getpychar = "D"

ElseIf (temp >= 46826 And temp <= 47009) Then

Getpychar = "E"

ElseIf (temp >= 47010 And temp <= 47296) Then

Getpychar = "F"

ElseIf (temp >= 47297 And temp <= 47613) Then

Getpychar = "G"

ElseIf (temp >= 47614 And temp <= 48118) Then

Getpychar = "H"

ElseIf (temp >= 48119 And temp <= 49061) Then

Getpychar = "J"

ElseIf (temp >= 49062 And temp <= 49323) Then

Getpychar = "K"

ElseIf (temp >= 49324 And temp <= 49895) Then

Getpychar = "L"

ElseIf (temp >= 49896 And temp <= 50370) Then

Getpychar = "M"

ElseIf (temp >= 50371 And temp <= 50613) Then

Getpychar = "N"

ElseIf (temp >= 50614 And temp <= 50621) Then

Getpychar = "O"

ElseIf (temp >= 50622 And temp <= 50905) Then

Getpychar = "P"

ElseIf (temp >= 50906 And temp <= 51386) Then

Getpychar = "Q"

ElseIf (temp >= 51387 And temp <= 51445) Then

Getpychar = "R"

ElseIf (temp >= 51446 And temp <= 52217) Then

Getpychar = "S"

ElseIf (temp >= 52218 And temp <= 52697) Then

Getpychar = "T"

ElseIf (temp >= 52698 And temp <= 52979) Then

Getpychar = "W"

ElseIf (temp >= 52980 And temp <= 53640) Then

Getpychar = "X"

ElseIf (temp >= 53689 And temp <= 54480) Then

Getpychar = "Y"

ElseIf (temp >= 54481 And temp <= 62289) Then

Getpychar = "Z"

Else

Getpychar = char

End If

End Function

Function Getpy(str)

For a = 1 To Len(str)

Getpy = Getpy & Getpychar(Mid(str, a, 1))

Next a

End Function

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)(4)

例如單元格區域C:C是中文姓名,需要在單元格區域D:D轉換成拼音首字母形式。只需在D2單元格中輸入函數“=Getpy(C2)”,然后進行單元格填充就可以啦。

excel自動提取姓名首字母拼音(中文怎么快速轉成拼音呢)(5)

是不是非常簡單便捷呢?抓緊時間把代碼收藏起來吧,有備無患。

點擊關注、轉發和收藏,有更多計算機小技巧等著您來發現。

TAGS標簽:  excel  自動  提取  姓名  字母  excel自動提取姓

歡迎分享轉載→http://www.avcorse.com/read-93127.html

Copyright ? 2024 有趣生活 All Rights Reserve吉ICP備19000289號-5 TXT地圖HTML地圖XML地圖