I have a little ditty below that pulls out the first and last number, seperated by a space. It normally works fine. However, when I pass one thing in, that looks just like all the others... I get Error 13, type mis match.
Sendkey = "SS7 18" ' Works
Sendkey = "SS23 19" 'Works
Sendkey = "SS1 1" 'Works
Sendkey = "SS1 2" 'Works
Sendkey = "SS23 8" 'DOES NOT WORK.
I'm guessing it has something to do with the first number being 2 numbers long and the 2nd number only being one. But the spacepos picks up the space as 3, and thats correct... Any ideas what I'm doing wrong here?
Code:
If InStr(Sendkey, "SS") > 0 Then
Sendkey = VBA.Replace(Sendkey, "SS", "")
SpacePos = InStr(Sendkey, " ")
Row = VBA.Left(Sendkey, SpacePos - 1)
Cols = VBA.Right(Sendkey, SpacePos) ' I get the error message on this line.
Call SS(Row, Cols)
Sendkey = ""
End If