在excel中怎样把汉字转换成拼音
1个回答
2016-12-17
展开全部
自定义函数,借用VLOOKUP函数。
宏代码如下:
Public Function MyFun(rng1 As Range) As String
Dim Len_rng1 As Integer
Dim aa As String
aa = ""
Len_rng1 = Len(rng1.Value)
For i = 1 To Len_rng1
A1 = Mid(rng1.Value, i, 1)
If aa = "" Then aa = Application.WorksheetFunction.VLookup(A1, Sheet2.Range("A:B"), 2, False) Else aa = aa & " " & Application.WorksheetFunction.VLookup(A1, Sheet2.Range("A:B"), 2, False)
Next
MyFun = aa
End Function
宏代码如下:
Public Function MyFun(rng1 As Range) As String
Dim Len_rng1 As Integer
Dim aa As String
aa = ""
Len_rng1 = Len(rng1.Value)
For i = 1 To Len_rng1
A1 = Mid(rng1.Value, i, 1)
If aa = "" Then aa = Application.WorksheetFunction.VLookup(A1, Sheet2.Range("A:B"), 2, False) Else aa = aa & " " & Application.WorksheetFunction.VLookup(A1, Sheet2.Range("A:B"), 2, False)
Next
MyFun = aa
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |