Excel Insert Slicer Control Greyed Out

tewmaster

New Member
Joined
Mar 20, 2016
Messages
2
Created a Pivot Table with VBA using Excel 2010 and now the slicer controls are greyed out; creating the same Pivot Table manually does allow use of the slicer controls. Is this a limitation of VBA created Pivot Tables?
 
I finally cracked the case of the Greyed Out Slicer control. It's been well documented that slicers only work with Excel 2010 going forward. I originally used the Pivot Cache 'Add' method to create the Pivot Table and the slicers were not available. I then used VBA Pivot Table Wizard code assuming that would use the latest format Excel 2010 format. It turns out that this is not the case, with the VBA Wizard code used the prior or pre-Excel 2010 format as well, hence pivot table slicers were not available. This seems to be an oversight on Microsoft's part. Since Excel 2010 was being used you would think it would use the latest, supported format, not the case. See the two code samples below to see the subtle difference. The Add method does use DefaultVersion:=xlPivotTableVersionCurrent so one would, logically at least, assume that Excel 2010 format was being used. The bottom line is that the version must be xlPivotTableVersion14 for slicers to work on VBA created Pivot Tables!
rolleyes.gif


The 'Add' Method Does Not Work:

Set PTCache = ActiveWorkbook.PivotCaches.Add(SourceType:= _
xlDatabase, SourceData:=PRange.Address)
Set PT = PTCache.CreatePivotTable(TableDestination:=WSP. _
Cells(2, 2), TableName:="PivotTbl", DefaultVersion:=xlPivotTableVersionCurrent)

Must Use the 'Create' Method:

Set PTCache = ThisWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:=PRange, Version:=xlPivotTableVersion14)
Set PT = PTCache.CreatePivotTable(TableDestination:=WSP.Cells(2, 2), _
TableName:="PivotTable", DefaultVersion:=xlPivotTableVersion14)
 
Upvote 0

Forum statistics

Threads
1,226,879
Messages
6,193,471
Members
453,802
Latest member
SarahNoob

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top