Grafit
Grafit

Reputation: 699

Pivot tables Run-time error 438: Object doesn't support this property or method

I'm totally flabbergasted

I have this line of code and I get this error everytime. I've tried so many things, putting it into variables, checking if all of the names are correct, clearing the cache, nothing seems to work.

Sheets("Uren verschil per vestiging").PivotTable("Draaitabel1").PivotFields("jaar mutatie").PivotItem(Year(Date)).Visible = True

Upvotes: 0

Views: 2090

Answers (1)

jkpieterse
jkpieterse

Reputation: 3006

Seems the syntax is off by one s:

Sheets("Uren verschil per vestiging").PivotTables("Draaitabel1").PivotFields("jaar mutatie").PivotItems(CStr(Year(Date))).Visible = True

Edited 20160212 to add an additional s after "PivotItem" and to add CStr around the Year function.

Upvotes: 1

Related Questions