G
Gina Liddle
I want to match the UserName to a PivotItem in the PivotField "PL", so to
display that item and hide all others. But when I run the below code I get
Run-time error 1004. However if I change the Visible = False is runs without
error.
How do I hide all items except the one that matches the UserName?
Ta,
G
Set APT = ActiveWorkbook.Worksheets("Job Monitoring").PivotTables _
("Job Monitoring Report").PivotFields("PL")
ResNum = APT.PivotItems.Count
ReDim ResID(ResNum)
For Res = 1 To ResNum
ResID(Res) = APT.PivotItems(Res)
fOSUserName
If fOSUserName = ResID(Res) Then
APT.PivotItems(ResID(Res)).Visible = True
End If
Next Res
display that item and hide all others. But when I run the below code I get
Run-time error 1004. However if I change the Visible = False is runs without
error.
How do I hide all items except the one that matches the UserName?
Ta,
G
Set APT = ActiveWorkbook.Worksheets("Job Monitoring").PivotTables _
("Job Monitoring Report").PivotFields("PL")
ResNum = APT.PivotItems.Count
ReDim ResID(ResNum)
For Res = 1 To ResNum
ResID(Res) = APT.PivotItems(Res)
fOSUserName
If fOSUserName = ResID(Res) Then
APT.PivotItems(ResID(Res)).Visible = True
End If
Next Res