I have an excel macro to filter and delete rows based on some criteria. It works, but sometimes the last row changes.
So I've just put it as 9999, but sometimes the last row could be more than 9999. Is there a way to improve the code? Thanks!
So I've just put it as 9999, but sometimes the last row could be more than 9999. Is there a way to improve the code? Thanks!
VBA Code:
Sub Macro3()
With Worksheets("Sheet1")
.Range("M1:M9999").AutoFilter 1, "<100000"
.Range("M2:M9999").SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
.Range("J1:J9999").AutoFilter 1, "<30"
.Range("J2:J9999").SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
.Range("c1:C9999").AutoFilter 1, "<=0.3"
.Range("C2:C9999").SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub