Sub copyRows()
Dim rng As Range
Dim rw As Variant
For Each rw In Sheets("reconcile").UsedRange.Rows
If Sheets("reconcile").Range("C" & rw.Row).Interior.Color = 52479 Then
If rng Is Nothing Then
Set rng = Sheets("reconcile").Range("C" & rw.Row).EntireRow
Else
Set rng = Union(rng, Sheets("reconcile").Range("C" & rw.Row).EntireRow)
End If
End If
Next
Sheets("result").Rows("2:" & Sheets("result").Rows.Count).Cells.Clear
If rng Is Nothing Then
Sheets("result").Visible = False
MsgBox "No Records Found"
Else
rng.Copy Sheets("result").Range("a" & Sheets("result").Rows.Count).End(xlUp).Offset(1, 0)
Sheets("result").Visible = True
End If
End Sub
|