Here's my code:
Sub DeleteRows() Dim ws As Worksheet Set ws = ActiveSheet For i = ws.Range("A65536").End(xlUp).Row To 2 Step -1 If ws.Cells(i, 9) <> "TRENCH_TYPE" Then ws.Rows(i).Delete End If Next End Sub
Attached is my worksheet. I want to remove everything but the header row & rows that have "Trench_Type" in column A. However it's deleting everything but my header.