Share via

VBA code to get slicer selection

Anonymous
2017-11-19T20:20:44+00:00

Split from this thread.

Hmmm ... not sure what I'm doing wrong then ... copied and pasted the code exactly ... tried it in a module, in the sheet itself, nothing ...

Steps:

  1. copy and paste code into VB code 'general' (in module or in sheet)
  2. right clicked slicer to get formula name to use for function
  3. in an excel cell, typed =getselectedsliceritems("Slicer_Location") ... autocomplete doesn't even find it

First it came back with the error "No slicer with name Slicer_Location" as though it ran the code and fell through to the error

Now it just shows the error #Name?

I have to be missing something??

Sorry, not a VBA programmer ...

Tina

**moved from Office / Excel / Windows other / Office 2010

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2017-11-19T22:54:33+00:00

    Actually when I put in the Option Explicit ... all worked just fine ... so the code is good ... thanks all for your help ... Tina

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-11-19T20:21:29+00:00

    I split your question into a new thread. Please post a screenshot of the slicer properties dialog and post the EXACT code from your VBA window.

    Was this answer helpful?

    0 comments No comments