I am trying to write VBA code to automatically change the filtered range in a multiple pivot tables to a desired 4 week range at the same time instead of having to manually filter them all. The Weeks are defined by week numbers 1-52 and not as actual dates. I have been unable to get any version of code to work on an individual pivot table and have not attempted to write the VBA to affect multiple tables at once.

Here is the last attempt of code that I tried, it resulted in a Run-time error '1004': Application-defined or object-defined error, with it highlighting the last line of code.
Sub Updateweekrange1()
If Range("T2").Value = "" Then
MsgBox ("You Must First Enter a Beginning Week#.")
Exit Sub
End If
If Range("V2").Value = "" Then
MsgBox ("You Must First Enter a Ending Week#.")
Exit Sub
End If
With ActiveSheet.PivotTables("Test2").PivotFields("Week")
.ClearAllFilters
.PivotFilters.Add Type:=xlValueIsBetween, DataField:=ActiveSheet.PivotTables("Test2").PivotFields("Week"), Value1:=Range("T2").Value, Value2:=Range("V2").Value
End With
End Sub
Any ideas on what I can do to achieve this filter would be greatly appreciated. Thank you!