I have a vba script that used to work by selecting a date range from some data. Now it does not select anything anymore. While debugging I realised that if I run the code to the point where the selection of <= Filterdate takes place and then go to the sheet, click on the dropdown selection, the criteria is correct. By pressing OK on the dialogue, the selection then takes place and the rest of the macro executes correctly.
It used to work, but now it does not anymore. Any help would be appreciated.
[pre]
[/pre]
It used to work, but now it does not anymore. Any help would be appreciated.
[pre]
Code:
Sub OverdueProjectsGrab()
'
' OverdueProjectsGrab Macro
'
'
Dim lastrow As Long
Dim FilterDate As Date
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A6:U" & lastrow).ClearContents
Range("B2").Select
FilterDate = ActiveCell.Value
Sheets("Data").Select
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
ActiveSheet.Range("$A$1:$U" & lastrow).AutoFilter Field:=14, Criteria1:="="
ActiveSheet.Range("$A$1:$U" & lastrow).AutoFilter Field:=12, Criteria1:= _
"<=" & FilterDate, Operator:=xlAnd
ActiveSheet.Range("$A$1:$U" & lastrow).AutoFilter Field:=11, Criteria1:=">1"
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Range("A2:U" & lastrow).Select
Selection.Copy
Sheets("Overdue Projects").Select
Range("A6").Select
ActiveSheet.Paste
Sheets("Data").Select
On Error Resume Next
ActiveSheet.ShowAllData
Err.Clear
Sheets("Overdue Summary").PivotTables("PivotTable1").RefreshTable
Sheets("Overdue Projects").Select
Range("B2").Select
End Sub