I have a worksheet of raw data, called Sh1 and one where I want my results, called Parse. I want a simple loop to walk through the rows (column A only) of Sh1, look for a specific word, and return a list of every row and position where that word occurs. This is my first time trying to write VBA code and I've been at it all day. My code is shown below and, yes, I know it's all jacked up. I'm hoping someone on here is willing to help me out. Thanks. -Matthew
Sub finddata()
Dim activityname As String
Dim finalrow As Integer
Dim i As Integer
Sheets("Parse").Range("A2:A20").ClearContents
activityname = Sheets("Parse").Range("A1").Value
finalrow = Sheets("Sh1").Range("A10000").End(xlUp).Row
Worksheets("Sh1").Activate
For i = 2 To finalrow
If InStr("A2:A20", activityname) > 0 Then
Range(Cells(i, 1), Cells(i, 2)).Copy
Else
Range(Cells(i, 1), Cells(i, 1)).Copy
End If
Worksheets("Parse").Activate
Range("P100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
Next i
End Sub
Sub finddata()
Dim activityname As String
Dim finalrow As Integer
Dim i As Integer
Sheets("Parse").Range("A2:A20").ClearContents
activityname = Sheets("Parse").Range("A1").Value
finalrow = Sheets("Sh1").Range("A10000").End(xlUp).Row
Worksheets("Sh1").Activate
For i = 2 To finalrow
If InStr("A2:A20", activityname) > 0 Then
Range(Cells(i, 1), Cells(i, 2)).Copy
Else
Range(Cells(i, 1), Cells(i, 1)).Copy
End If
Worksheets("Parse").Activate
Range("P100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteFormulasAndNumberFormats
Next i
End Sub