J
J.W. Aldridge
I found the following code, but it doesnt work for me.
I need a code that will delete Rows A-H based on the data in column
A.
Example:
PCPB
PCPA
PCPC
PCPB
PCPD
PCPC
PCPB
I want to delete every row that doesn't start with PCPB.
This code doesnt work for me:
Dim LastRow As Long
Dim RowNdx As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'<change column letter if desired
For RowNdx = LastRow To 1 Step -1
'<change '1' to ending row if desired
If Left(Cells(RowNdx, "A"), 7) <> "PCPB" Then
Rows(RowNdx).Delete
End If
Next RowNdx
I need a code that will delete Rows A-H based on the data in column
A.
Example:
PCPB
PCPA
PCPC
PCPB
PCPD
PCPC
PCPB
I want to delete every row that doesn't start with PCPB.
This code doesnt work for me:
Dim LastRow As Long
Dim RowNdx As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
'<change column letter if desired
For RowNdx = LastRow To 1 Step -1
'<change '1' to ending row if desired
If Left(Cells(RowNdx, "A"), 7) <> "PCPB" Then
Rows(RowNdx).Delete
End If
Next RowNdx