SandsB
Well-known Member
- Joined
- Feb 13, 2007
- Messages
- 736
- Office Version
- 365
- Platform
- Windows
The code below is what I use to filter records for a particular person. If the cell doesn't match what's in K3 it's deleted. But that also deletes the top row with my headers. How can I modify this to leave row 1?
'DELETE all records except those for the Username specified in K3
Sheets("Pending").Select
Last = Cells(Rows.Count, "L").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "L").Value) <> Worksheets("Sheet3").Range("K3") Then
Cells(i, "A").EntireRow.Delete
End If
Next i
'DELETE all records except those for the Username specified in K3
Sheets("Pending").Select
Last = Cells(Rows.Count, "L").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "L").Value) <> Worksheets("Sheet3").Range("K3") Then
Cells(i, "A").EntireRow.Delete
End If
Next i