The macro is suppose to:
1. search an entire sheet called "babies" for a given phrase ("puppies")
2. copy each row with the phrase ("puppies")
3. paste each row into the "dogs" sheet
The for loop should use the countif function to tell it how many times to loop and each loop when copy/paste.
I get the "code execution has been interrupted" error and the yellow error points to the "Next lloop" line.
Any thoughts???
[code]
Sub complete()
Dim lloop As Long
Dim rFound As Range
Set rFound = Range("A2")
For lloop = 1 To WorksheetFunction.CountIf(Sheets("babies").Range("B:B"), "puppies")
Set rFound = ActiveSheet.UsedRange.Find _
(What:="puppies", After:=rFound, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext)
rFound.EntireRow.Copy _
Destination:=Sheets("dogs").Cells(Rows.Count, 1).End(xlUp)(2, 1)
Next lloop
End Sub
[code/]
Bookmarks