Hello All,
I am pretty new at this, trying to write a code, which delete the rows on a sheet which contain 2 different kind of data:
Autofilter is not an option becasue Iwant to use a sheet for another macro afterwards.
I made a code, but unfortunately it is not working.
Could anyone help me please, what am I missing? Thanks in advance
I am pretty new at this, trying to write a code, which delete the rows on a sheet which contain 2 different kind of data:
Autofilter is not an option becasue Iwant to use a sheet for another macro afterwards.
I made a code, but unfortunately it is not working.
Could anyone help me please, what am I missing? Thanks in advance
Code:
Sub Delete()
ActiveSheet.Unprotect (Password)
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For a = 1 To WorksheetFunction.CountA(Range("J:J"))
If a = "*Error in document*" Then
EntireRow.Delete
If a = "Do not assign*" Then
EntireRow.Delete
Else
End If
End If
Next
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
ActiveSheet.Protect (Password), DrawingObjects:=True, Contents:=True, Scenarios:=True, _
AllowSorting:=True, AllowFiltering:=True
End Sub