excel里如何做到在A1输入“好好学习”,B1自动显示“HHXX”(文字的拼音...

发布网友 发布时间:1天前

我来回答

2个回答

热心网友 时间:1天前

回答的底部有配图及上传已做好的附件:


打开EXCEL,先按ALT+F11组合键,执行“插入→模块”命令,插入一个新模块。再双击插入的模块,进入模块代码编辑状态,把以下代复制粘贴到右边的空白窗口,送闭该窗口,在B1输入公式下拉即可。


B1公式:

=IF(A1="","",getpy(A1))


代码如下:(本行不要复制)

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 -175: pinyin = "J"

Case -174 To -16213: pinyin = "K"

Case -16212 To -151: pinyin = "L"

Case -150 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




热心网友 时间:1天前

不可能的吧,计算机还没有那个能力

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com