Hi
Your requirement are not to clear. However, this code will loop trough sheet named Original_List looking for PID or OBR and will copy this info to sheet name Sort_List.
It is always a good practice to attached a sample of your work and sample of what you are expected to have.
Sub sort_pid()
'Assuming your data is on sheet named Original_List
'Assuming the new info will be on a sheet named Sort_List
Sheets("Original_List").Select
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To rowcount
Sheets("Original_List").Select
Range("a" & i).Select
valu = ActiveCell.Value
If valu = "PID" Or valu = "OBR" Then
ActiveCell.EntireRow.Copy
Sheets("Sort_List").Select
rowcount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
Range("a" & rowcount + 1).Select
ActiveCell.PasteSpecial (xlPasteAll)
End If
Next
End Sub
Bookmarks