如何从excel宏中的ma系列数字中选择一组数字?假设我想从“16964926469263”中选择第 5 位到第 9 位的数字?
-- 维诺德
尝试这个
Sub Sample()
Dim sNumber As String
Dim StartNumber As Long
Dim EndNumber As Long
Number = "16964926469263"
StartNumber = 5
EndNumber = 9
Debug.Print Mid(Number, StartNumber, EndNumber - StartNumber + 1)
End Sub
这会给你49264
如果您想在第 9 位之前使用
Sub Sample()
Dim sNumber As String
Dim StartNumber As Long
Dim EndNumber As Long
Number = "16964926469263"
StartNumber = 5
EndNumber = 9
Debug.Print Mid(Number, StartNumber, EndNumber - StartNumber)
End Sub
这会给你4926