Copy/paste rows to new sheet based on cell value

T

Taylor

I have a large spreadsheet in which one column returns "check status",
"visit", or "Send Letter 2" based on an IF/THEN formula. Is there a way to
automatically select those rows containing "check status", "visit", and "Send
Letter 2", copy the row and paste it onto a new sheet? Do I need a macro for
this?
 
D

Dan R.

This assumes your values are in column A:

Sub CopyRows()
lrow = Sheets(1).Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To lrow
dest = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row
If Cells(i, 1).Value = "check status" Or _
Cells(i, 1).Value = "visit" Or _
Cells(i, 1).Value = "Send Letter 2" Then
Rows(i).Copy Sheets(2).Rows(dest + 1)
End If
Next i
End Sub
 

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