Hello Everyone,
I am looking for some help with modifying a Macro I have:
This Macro deletes all rows that DO NOT contain the numbers 0, 1, 2, 3, 4 and 5 in column D.
I would like it if it ALSO DID NOT delete the rows containing a negative number in column D.
(The negative numbers can go from -1 to -160).
I am not sure how I can add this to the array.
I have tried adding "<>*-*" or "<0" to the array but this does not work …
Any help would be very much appreciated!
Thanks in advance!
Sub DeleteRows_Comercial_AGOTADOS()
Dim rData As Range, ws As Worksheet
Application.ScreenUpdating = False
With Sheets("AGOTADOS")
.AutoFilterMode = False
.Range("A1").AutoFilter 4, Array("1", "2", "3", "4", "5", "0"), xlFilterValues
On Error Resume Next
Set rData = .AutoFilter.Range.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rData Is Nothing Then
Set ws = Sheets.Add()
rData.Copy ws.Range("A1")
.Delete
ws.Name = "AGOTADOS"
End If
End With
Application.ScreenUpdating = True
End Sub
Bookmarks