A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
This should pick up the value from C2 in Sheet 1
Sub Test()
'
' Test Macro
'
Dim wks As Worksheet
Dim pvt As PivotTable
'On Error Resume Next
For Each wks In Worksheets
For Each pvt In wks.PivotTables
msgbox "About to modify " & pvt.name & " on sheet " & wks.name
pvt.PivotFields("TWeek").PivotItems(worksheets("Sheet1").Range("C2").Value).Visible = True
Next pvt
Next wks
End Sub
It is looking at all pivot tables on all sheets. The code aboe has a message box to confirm the pivot tables it is about to try to modify. If the pivot table does not have "TWeek" in it what did you want the code to do? There is nothing to set on that pivot table.