I got this code form Ozgrid that works great other than everytime I run the macro it copies everything over again.
Sub CopyRows()
Dim rng As Range
Dim cl As Range
Dim str As String
Set rng = ActiveSheet.UsedRange 'the range to search ie the used range
str = "Yes" 'string to look for
For Each cl In rng 'checkeach cell
If cl.Text = str Then
'if the ell contains the correct value copy it to next empty row on sheet 2 & delete the row
cl.EntireRow.Copy Destination:=Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End If
Next cl
End Sub
What do I put in my code so it does not duplicate? Other words I run the macro once and it finds all the "Yes". Then I input some more "Yes" and run it again. Now it has copied everything even the same ones from the first copy. Please advise. Thank you.
Bookmarks