Read all selected slicer item values to an array variable

允我心安 提交于 2019-12-11 17:29:56

问题


How to read all selected slicer item values to an array variable? I thought this might work:

Dim MyArr() as Variant
MyArr = ActiveWorkbook.SlicerCaches(1).VisibleSlicerItemsList

But it does not. Some reference:
https://docs.microsoft.com/en-us/office/vba/api/excel.slicercache.visiblesliceritemslist


回答1:


You can't use VisibleSlicerItemsList, unless you are using an OLAP data source. From the documentation:

The VisibleSlicerItemsList property is only applicable for slicers that are based on OLAP data sources.

I think the easiest way is to iterate over VisibleSlicerItems.



来源:https://stackoverflow.com/questions/54945719/read-all-selected-slicer-item-values-to-an-array-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!