LuckyDuck528
Programmer
This should be simple but I'm just not seeing the error in my logic to make this work.
Below is my code and what I am trying to do is say:
1. Is this array exists, search for this string in the array
2. If you find a match. Flag it and move on in the program.
3. If you don't find a match. Add this string to the array
and print it in the next available spot.
4. If the array doesn't exists yet, create it and print
this at the first value.
The problem is that I can tweak and rearrange this thing as much as I want and sometimes I get an infinite loop, othertimes it won't print anything and other times it will only print the first value... depending on how it's arranged when running...
If anyone has any ideas I would be SO incredibly greatful for your help!
Thank You!
Below is my code and what I am trying to do is say:
1. Is this array exists, search for this string in the array
2. If you find a match. Flag it and move on in the program.
3. If you don't find a match. Add this string to the array
and print it in the next available spot.
4. If the array doesn't exists yet, create it and print
this at the first value.
The problem is that I can tweak and rearrange this thing as much as I want and sometimes I get an infinite loop, othertimes it won't print anything and other times it will only print the first value... depending on how it's arranged when running...
If anyone has any ideas I would be SO incredibly greatful for your help!
Thank You!
Code:
Flag = 0
If IsArray(arrComp) Then
For intq = LBound(arrComp) To UBound(arrComp)
If strm = arrComp(intq) Then
'Do Nothing
Flag = 1
End If
Next
If Flag <> 1 Then
ReDim Preserve arrComp(UBound(arrComp) + 1)
arrComp(UBound(arrComp)) = strm
inthere=inthere+1
intHereTrack= intHereTrack + 1
ExcelBook.Worksheets(3).Cells(inthere,1).Value=strm
Else
arrComp = Array(strm)
inthere=inthere+1
intHereTrack= intHereTrack + 1
ExcelBook.Worksheets(3).Cells(inthere,1).Value=str
End If
End If