copy rows to another worksheet with conditions

  • Thread starter Thread starter Rudymill
  • Start date Start date
R

Rudymill

If a conditions is met in one of the cells in a row, I would like to copy
that row to another worksheet.

For example, if one cell contains "Family", then I would like to copy the
entire row to another worksheet.

TIA

rudy M
 
Sub newone()
Dim RngColF As Range
Dim i As Range
Dim Dest As Range
Sheets("Sheet1").Select
Set RngColF = Range("B1", Range("B" & Rows.Count).End(xlUp))
With Sheets("Sheet2")
Set Dest = .Range("A1")
End With
For Each i In RngColF
If i.Value = "Family" Then
i.EntireRow.Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub

This assumes that your family is in Column B. Modify to suit your needs.

Regards,
Ryan---
 
Can you modify this a little to allow the i.value to be a range of values,
like 1-5 and for each value, it create a new worksheet? So when it finds rows
with a cell value of 1 it creates a worksheet named 1, then cycles through
the other values?

I have already benefited from what you put here, thanks.
 
Back
Top