完整代码
所在版块:心情闲聊 发贴时间:2024-05-11 22:24

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Function NumberToLetters(ByVal numberString As String) As String
Dim result As String
Dim char As String
Dim digit As Integer
Dim letterMap(0 To 9) As String


letterMap(0) = "a"
letterMap(1) = "q"
letterMap(2) = "w"
letterMap(3) = "e"
letterMap(4) = "r"
letterMap(5) = "t"
letterMap(6) = "y"
letterMap(7) = "u"
letterMap(8) = "i"
letterMap(9) = "o"


For i = 1 To Len(numberString)


char = Mid(numberString, i, 1)
If IsNumeric(char) Then
digit = CInt(char)


If digit >= 1 And digit <= 9 Then

result = result & letterMap(digit)
Else

End If
End If
Next i


NumberToLetters = result
End Function

Sub Button1_Click()
Set ws = ThisWorkbook.Sheets(1)
Dim numberString As String
Dim outputLetters As String

numberString = ws.Range("B1").Value
Debug.Print numberString
outputLetters = NumberToLetters(numberString)
Debug.Print outputLetters
ws.Range("B3").Value = outputLetters

End Sub
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
万能求助excel qffyy   (129 bytes , 1929reads )
假设A1 是数字串 B1是QWERTYUIOP 功夫熊猫   (246 bytes , 9reads )
这个公式也好用。谢谢! qffyy   (63 bytes , 8reads )
长有什么关系 反正单元格是输出结果 别人又看不到 功夫熊猫   (0 bytes , 2reads )
果然是万能的华新 qffyy   (8 bytes , 8reads )
我会用 小土   (153 bytes , 8reads )
没想明白怎么单一用VLOOKUP, qffyy   (32 bytes , 11reads )
写两个 小土   (145 bytes , 6reads )
谢谢,高手啊,套用怎么多公式, qffyy   (29778 bytes , 15reads )
excel版本问题吧 lmj8808   (31 bytes , 6reads )
谢谢,是excel版本问题 qffyy   (21 bytes , 11reads )
可以只用excel formula的 lmj8808   (225 bytes , 13reads )
完整代码 jurong99   (1134 bytes , 12reads )
谢谢 qffyy   (27 bytes , 8reads )
包含上面代码的完整的excel示例 jurong99   (31 bytes , 8reads )
如果只是代换 鸡兔同笼01   (10 bytes , 3reads )
要出现的计算数字结果 qffyy   (20 bytes , 8reads )
vlookup? Jackie_2   (0 bytes , 6reads )
我也觉得 小土   (15 bytes , 2reads )
一个数字一个数字拆开 qffyy   (22 bytes , 8reads )