Hello and thanks for coming to my post! I apologize for any inefficiency or ignorance that may pop up.

I have a program that sorts through data and exports to excel. This works fine on a small file but when using a bigger one it runs down then repeats the same line around 1k times then moves on to wrap it up.

Code:
Dim lineindex As Integer
Dim first As Integer
Dim currentlinetext As String 

Do While indexToText <> -1
            indexToText = rtbResults.Find(mstrSearch)

            'this code executes each time the search finds a hit. 
            If indexToText <> -1 Then
                lineindex = Me.rtbResults.GetLineFromCharIndex(indexToText)
                first = Me.rtbResults.GetFirstCharIndexFromLine(lineindex)
                currentlinetext = rtbResults.Lines(lineindex)

                Dim quote As String = "'"
                Me.rtbResults.Select(first, currentlinetext.Length)
                Results2 += rtbResults.SelectedText & quote
                rows = rows + 1
                Me.rtbResults.SelectedText = ""
            Else

            End If
        Loop

from what I see it looks like currentlinetext isn't updating as it continues down the lines. I'm just not sure.



Example of results
A file I'd go to sort through

bolt info program name blah blah blah
step 1
step 2
step 3
bolt info program name blah blah blah
step 1
step 2
step 3
bolt info program name blah blah blah
step 1
step 2
step 3


sorted small file results:
step 1
step 1
step 1
step 2
step 2
step 2
step 3
step 3
step 3


sorted large file results:
step 1
step 1
step 1
step 2
step 2
step 2
step 2
step 2
step 3

Any input is appreciated. I only included what I thought was necessary but will happily provide additional files/info if required.
Thank you for your time. I hope I properly explained my problem.