kelly mort
Well-known Member
- Joined
- Apr 10, 2017
- Messages
- 2,169
- Office Version
- 2016
- Platform
- Windows
Code:
Sub LoopThroughArray()
'create array
Dim strName() As Variant
strName() = Array(1, 2, 3, 4, 5, 6)
Dim strFind as string
strFind = 20
Dim i As Long
'loop through the array
For i = LBound(strName, 1) To UBound(strName, 1)
If InStr(strName(i), strFind) > 0 Then
MsgBox "Number has been found!"
Exit For
End If
Next i
End Sub
My goal is to be able to find a way to load 1 up to 100 or any upper limit without doing all the numbering manually.
Code:
strName() = Array(1, 2, 3, 4, 5, 6)
Please I need help.
Thanks