I have a sort of interesting task. I have text loaded where I must find a certain line that starts with a certain word and then from there parse out a piece. This what I got. It find the positions ok but Im confused about having it start at the specified line and then finding the piece to parse.It hits a error where retval is (error 5) All it has to do is count the number of occurences. here's the code
Code:hum = InStr(1, searchstring, "Human", vbTextCompare) Do hum = InStr(hum + 1, searchstring, "Human", vbTextCompare) ReDim Preserve humpos(humcount) humpos(humcount) = hum humcount = humcount + 1 Loop While hum <> 0 counter2 = 0 For i = LBound(humpos) To UBound(humpos) retval = InStr(humpos(i), searchstring, find, vbTextCompare) Debug.Print If retval Then counter2 = counter2 + 1 End If Next i Debug.Print counter2





Reply With Quote