In Excel 2010 when I use the macro recorder to select a pivot item in field Name I get a code (shown below). If I run this code it works. However if I do the same thing for a field called Date the macro doesn't work when I run it. Instead I get the following error: "Run-time error '1004' Unable to get the PivotItems property of the PivotField class"
I've been spending far too much time on this and it's driving me mad. Could someone tell me why the Name field macro works but the Date field macro doesn't?
Name code
With ActiveSheet.PivotTables("PT_MME_Detailed").PivotFields("Name")
.PivotItems("John.Doe").Visible = False
End With
Date code
With ActiveSheet.PivotTables("PT_MME_Detailed").PivotFields("Date")
.PivotItems("1/3/2013").Visible = False
End With
Bookmarks