+ Reply to Thread
Results 1 to 10 of 10

Help with VB Code to pass a selection to another workbook's slicer

Hybrid View

rv02 Help with VB Code to pass a... 07-07-2015, 11:20 AM
LordLoki Re: Help with VB Code to pass... 07-07-2015, 11:31 AM
rv02 Re: Help with VB Code to pass... 07-07-2015, 11:44 AM
LordLoki Re: Help with VB Code to pass... 07-07-2015, 11:49 AM
rv02 Re: Help with VB Code to pass... 07-07-2015, 12:34 PM
LordLoki Re: Help with VB Code to pass... 07-07-2015, 12:56 PM
LordLoki Re: Help with VB Code to pass... 07-07-2015, 02:44 PM
rv02 Re: Help with VB Code to pass... 07-07-2015, 03:03 PM
LordLoki Re: Help with VB Code to pass... 07-07-2015, 06:44 PM
rv02 Re: Help with VB Code to pass... 07-08-2015, 01:11 AM
  1. #1
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Help with VB Code to pass a selection to another workbook's slicer

    Hi All

    I would appreciate you help on the following problem.

    I have two workbooks each having power Pivot Tables on them. From workbook1 user is presented with a choice of which salesperson's report they want to open. What I need is a code that based on Selection in workbook1 then Workbook2 will open and the slicers in Workbook2 will have the correct name already selected that matches the selection in workbook2. I have the coide which opens the report in WB2 but not sure how to pass the sleection from Combobox in WB1 to WB2's slicer. I.e. if user selects John in WB1's ComboBox then WB2 will open and the slicer value for name will be set to John so only John's data is visible.

    Is this possible at all?

    Thanks in advance

  2. #2
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Hi rv02,

    This is possible.
    I would create a Function on the Second Sheet that takes a Slicername and a string Array as parameters
    Then put the Selection of the first sheet into an Array
    Open the 2nd Workbook and call the Function passing the Array and Slicername.

    Greets
    Loki

  3. #3
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Thanks for your help I wil ltry this

  4. #4
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Help with VB Code to pass a selection to another workbook's slicer

    if you can post the 2 workbooks as an example i can help you with the Code.
    Without that its a little bit tricky to help cause the slicer part can be very strange :D
    When i am home later i can try give you an example workbook.
    I did a lot coding with slicers so i know they are a pain in the *** :D

  5. #5
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help with VB Code to pass a selection to another workbook's slicer

    I have attcahed two very simple worokbook to demonstrate what I need to do.

    In Wb1 youcan select a neame of the sale sperson and once you click on OK I need WB2 to open and the slicer in Pivot report sheet (Report) to automatically select the which was chosen in WB1.

    I hope this make sense, and thank for your help.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Cool that will help. I just found out that the slicer thing is a bit more complicated with powerpivot. But it's still doable. Will check on that later.

    Gesendet von meinem HTC One mit Tapatalk

  7. #7
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Help with VB Code to pass a selection to another workbook's slicer

    I looked at your Sheets and i need you to specifiy again what is the Source for the Slicer is it a normal Pivot or a Pivot from PowerPivot which is a special Addin

    Cause the Approach for powerpivot is different and more complex.
    And in your example Sheet you have a normal Pivot

    Also in the Source File the user can Only select one Entry is that Correct for the Rea thing too?

    Greets
    Loki

  8. #8
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Unfirtunatle the source is from Power Pivot.

  9. #9
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Hi rv02,

    Attached you find an example with 2 workbooks
    just store them both in the same folder and run the selector
    the code for selection is in the data file and gets executed when you open it via selector file

    greets
    Loki
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    06-17-2014
    Location
    london
    MS-Off Ver
    365
    Posts
    398

    Re: Help with VB Code to pass a selection to another workbook's slicer

    Dear Loki

    Thank you so much for your help and your time. This is perfect and its excatly what I needed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Macro to Run when Slicer Selection is Changed
    By MBeedle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2017, 09:29 AM
  2. Limiting a pivot table slicer to one selection
    By behrensf84 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2014, 09:25 PM
  3. Limiting Slicer multiple selection
    By Paul-NYS in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 12-17-2012, 02:58 PM
  4. Slicer Macro - unfilter another slicer on selection
    By chadheins in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-24-2012, 10:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1