Hi
I've got a list 4 statuses in column U of a Sheet (Active, Inactive, Pending Active and Pending Inactive).
I thought this code would work, but it deletes ALL 4 options, instead of leaving the Active rows.
Does anyone know how to modify this so that it deletes everything BUT the Active rows, please?
Also, do I need to repeat the code for every option?
TIA
I've got a list 4 statuses in column U of a Sheet (Active, Inactive, Pending Active and Pending Inactive).
I thought this code would work, but it deletes ALL 4 options, instead of leaving the Active rows.
Does anyone know how to modify this so that it deletes everything BUT the Active rows, please?
Also, do I need to repeat the code for every option?
TIA
VBA Code:
On Error Resume Next
With ActiveSheet
.Range("U1:U").AutoFilter 20, "Inactive"
.AutoFilter.Range.Offset(1).EntireRow.Delete
.Automodefilter = False
End With
On Error GoTo 0
On Error Resume Next
With ActiveSheet
.Range("U1:U").AutoFilter 20, "Pending Inactive"
.AutoFilter.Range.Offset(1).EntireRow.Delete
.Automodefilter = False
End With
On Error GoTo 0
On Error Resume Next
With ActiveSheet
.Range("U1:U").AutoFilter 20, "Pending Active"
.AutoFilter.Range.Offset(1).EntireRow.Delete
.Automodefilter = False
End With
On Error GoTo 0
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Status |
Inactive |
Active |
Pending Inactive |
Pending Active |