I'm trying to delete a row in excel if it meets the criteria that the value in Column B is less than 100. I saw this and tried to follow it, but I'm not that knowledgeable in VBA, so I'm not sure where to go.
EDIT This is the code I've tried thus far, and it does not work.
Sub DeleteR()
Dim myRow As Range
Dim toDelete As Range
For i = 2 To 5000
If Worksheets("PalCountPLTZR").Cells(i, 2) < "99" Then
Set myRow = Worksheets("PalCountPLTZR").Rows(i)
If toDelete Is Nothing Then
Set toDelete = myRow
Else
Set toDelete = Union(toDelete, myRow)
End If
End If
Next i
End Sub
I'm not sure why it does not work, but I'm wondering if the cells that its looking at are from a query.