我有一个字符串
Dim A As String
A = "A23"
B = "bd4"
我只需要得到数值作为输出,如下
A = 23
B = 4
您可以在这里使用正则表达式替换:
Dim A As String: A = "A23"
Dim AOut As String
Dim pattern As String: pattern = "D+"
Set regEx = CreateObject("VBScript.RegExp")
With regEx
.Global = True
.Pattern = pattern
End With
AOut = regEx.Replace(A, "")
Debug.Print AOut
Dim A As String
A = "bd4"
number_val = Range(A).Row
MsgBox (number_val)
我们可以使用range函数,它给出字符串中的数字。