Hi everybody, I need help.
I'd like get each displayed numbers to be in a variable like this :
var1 = 1
var2 = 2
var3 = 3...
Below is my function, it's working perfectly displaying the twelve numbers in the Debug Window but I'd like to be able to do as explained above.
Thanks in advance!
I'd like get each displayed numbers to be in a variable like this :
var1 = 1
var2 = 2
var3 = 3...
Below is my function, it's working perfectly displaying the twelve numbers in the Debug Window but I'd like to be able to do as explained above.
Code:
Sub PrintWords(stInput As String)
Dim inCounter As Integer
Dim inFoundPos As Integer
Const PARSECHAR = "," 'Space
'If string is blank then do nothing
If Len(stInput) = 0 Then Exit Sub
'Start at the first character
inCounter = 1
'Search for a space
inFoundPos = InStr(inCounter, stInput, PARSECHAR)
'If a space is found print the word and keep searching
While inFoundPos <> 0
Debug.Print Mid$(stInput, inCounter, inFoundPos - inCounter)
inCounter = inFoundPos + 1
inFoundPos = InStr(inCounter, stInput, PARSECHAR)
Wend
'Print the remainder of the string
If inCounter < Len(stInput) Then
Debug.Print Mid$(stInput, inCounter)
End If
End Sub
Code:
Private Sub Command1_Click()
PrintWords ("1,2,3,4,5,6,7,8,9,10,11,12")
End Sub
Thanks in advance!