Hello, need some ideas? i have this code and it was perfect but i have some errors? and I don?t understand why.
This is the code:
Private Sub Worksheet_Activate()
Dim UR As Range
Set UR = Sheets("Urmarire 2022").UsedRange
Sheets("Restante").Cells.ClearContents
UR.AutoFilter 16, "<" & CDbl(Date + 3) ' here i have this error: run time error 1004 autofilter method of range class failed
UR.AutoFilter 15, ""
UR.SpecialCells(xlCellTypeVisible).Copy Sheets("Restante").Cells(1, 1)
UR.AutoFilter
For x = 1 To Cells(Rows.Count, "p").End(xlUp).Row
If Cells(x, 16) < Date Then
Cells(x, 16).Interior.Color = vbRed
End If
Next x
End Sub
Bookmarks