Try it as below instead:
Sub test() Dim fDay As Variant, endRow As Long fDay = DateSerial(Year(Date), Month(Date), 1) endRow = Range("O" & Rows.Count).End(xlUp).Row Range("O7").AutoFilter Field:=15, Criteria1:="<" & CLng(fDay) On Error Resume Next Range("8:" & endRow).SpecialCells(xlCellTypeVisible).Delete On Error GoTo 0 Range("O7").AutoFilter Field:=15 End Sub




Reply With Quote