copy rows to another worksheet with conditions

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
 
R

ryguy7272

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---
 
J

J

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top