I am trying to make a keyword search loop that can scan abstracts of research papers that are imported into excel using a different program. The abstracts of these research papers are all in column K, and when I run the code I get only the keyword(0) copied into another sheet. I've rearranged the keywords and proven that the search does in fact work for the first rendition, but the for loop itself does not execute, or the while loop ends after the first execution.
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
Dim keyword(3) As String
Dim i As Integer
On Error GoTo Err_Execute
LSearchRow = 2
LCopyToRow = 2
keyword(0) = "financial crisis"
keyword(1) = "credit default swap"
keyword(2) = "market manipulation"
keyword(3) = "financial crisis"
Sheets("Research").Select
For i = LBound(keyword) To UBound(keyword)
While Len(Range("K" & CStr(LSearchRow)).Value) > 0
If InStr(1, Range("K" & CStr(LSearchRow)).Value, keyword(i)) > 0 Then
'Select row in Sheet to copy
Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
Selection.Copy
'Paste row into Sheet in next row
Sheets("Research").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
'Move counter to next row
LCopyToRow = LCopyToRow + 1
'Go back to Sheet2 to
Sheets("Research").Select
End If
LSearchRow = LSearchRow + 1
Wend
Next i