Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21839

Delete rows

$
0
0
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

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


Viewing all articles
Browse latest Browse all 21839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>