Getting Slicer Values

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Getting Slicer Values

Post by Rudi »

Hi,

Just experimenting...
2 Questions

1. I have event code to collect the slicer value and put it in a cell. The Ship Via value is working great, but is there a way you have the code provide ONLY the subset of dates for the Ship Via filter?
2. I see that the slicer is available as a named range. Is there any way I can used that named range in a formula?

See the attached for details.
TIA
Slicer Values.xlsm
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Getting Slicer Values

Post by HansV »

1. Try this:

Code: Select all

    For Each sItem In cache.SlicerItems
        i = i + 1
        If sItem.Selected = True And sItem.HasData Then
            Worksheets("Sheet2").Range("I11").Offset(i).Value = CDate(sItem.Value)
        End If
    Next sItem
2. No. If you use Jan Karel Pieterse's indispensable Name Manager add-in, you'll see that the slicer names refer to the formula ="", so you can't do anything useful with them.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Getting Slicer Values

Post by Rudi »

The code works great now.
Thanks for that, and clarity on Q#2
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.