VBA looping/range

camtognetti Posts 1 Registration date Friday August 19, 2016 Status Member Last seen August 19, 2016 - Aug 19, 2016 at 07:14 PM
Hello, im attempting to run this but I want to add in separate loops that search for certain keywords. currently this successfully will find one and move those rows to another sheet. I want it to do this but create multiple sheets for search words such as "dupe, class action, feeder, qtp, unadvised," could someone advise on how to extend this macro for this? also this one does miss a few while searching is there someway to fix the range? im new and not really familiar with the effective ways of VBA

Sub customcopy()
Dim strsearch As String, lastline As Integer, tocopy As Integer

strsearch = CStr(InputBox("enter the string to search for"))
lastline = Range("A65536").End(xlUp).Row
j = 1

For i = 1 To lastline
For Each c In Range("B" & i & ":Z" & i)
If InStr(c.Text, strsearch) Then
tocopy = 1
End If
Next c
If tocopy = 1 Then
Rows(i).Copy Destination:=Sheets(2).Rows(j)
j = j + 1
End If
tocopy = 0
Next i

End Sub