Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21839

Array Trouble

$
0
0
I need to search an array, compare it to text in a combobox, and retreive the index number!! Here's what i have;

dim DaytonType as string
dim i as integer

Here i'm loading the array from excel, works perfectly.
For i = 2 To 1000
DaytonType = Split(xlsheet.Cells(i, 1))
If xlsheet.Cells(i, 1) = "" Then Exit For
.ProductCodeSelect.AddItem Sheets("ENGLISH").Cells(i, 1)
Next i

Below i'm comparing text from a combobox, to the array, problem, "Subscript out of range", jumps out of the for next loop, right away!

I tried redim the array, "Redim DaytonType(0)" I tried "i =0"

For i = 0 to To UBound(DaytonType)
If InStr(DaytonType(i), .ProductCodeSelect.Text) > 0 Then
Idx = i
Exit For
End If
Next i

Where am i going wrong???

Viewing all articles
Browse latest Browse all 21839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>