用户信息
经验: 242
等级:
2 初出茅庐
资产: 308 华新币
发贴: 56
在线: 218.4 小时
复制本帖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
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!