+ Reply to Thread
Results 1 to 5 of 5

Select Multiple Values in a Slicer using VBA

  1. #1
    Registered User
    Join Date
    01-05-2016
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    3

    Select Multiple Values in a Slicer using VBA

    I have a powershell script that passes in a parameter called widgets into a Widgets macro. The Widgets macro uses slicers to return the total cost of the Widgets sold.

    Up until now I have only ever needed to total up 1 type of Widget however I would now like to combine multiple widgets (e.g. the total sales for both Red and Blue Widgets). I have tried passing in "Red Widgets, Blue Widgets" but the code is looking for a Widget called Red Widgets, Blue Widgets.

    I suspect I need to use an array but in the majority of cases I only need to look up the total cost for one type of Widget.

    I have provided what I think is the relevant parts of my code and was wondering if you could assist me in adapting it to work as required.


    '
    Please Login or Register  to view this content.
    Last edited by Pepe Le Mokko; 12-16-2019 at 09:11 AM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,451

    Re: Select Multiple Values in a Slicer using VBA

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  3. #3
    Registered User
    Join Date
    01-05-2016
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Select Multiple Values in a Slicer using VBA

    Apologies for not enclosing the code within code tags.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Select Multiple Values in a Slicer using VBA

    Something like the following, where you loop through the various widgets.

    Please Login or Register  to view this content.
    You could also use the SPLIT function, instead of ARRAY, to convert a delimited list into an array
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    01-05-2016
    Location
    London
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Select Multiple Values in a Slicer using VBA

    Andy,

    Thank you very much for your solution, it works a treat!

    Kind Regards Nick

+ 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. Loop through slicer, but don't do slicer action when values are unselected
    By as_sass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-08-2018, 04:55 PM
  2. Loop through slicer, while also selecting single slicer value on separate slicer
    By as_sass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2018, 01:41 PM
  3. Replies: 1
    Last Post: 04-23-2018, 09:43 AM
  4. VBA to select certain names from a slicer.
    By Mr.Bigz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2018, 09:25 AM
  5. Replies: 0
    Last Post: 08-13-2015, 12:05 PM
  6. Newbie: Auto Select/un-Select an Range of Slicer Items
    By luckyali in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-23-2014, 09:52 AM
  7. Select multiple values from an Excel table in a slicer using VBA
    By ecotm034 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2014, 07:28 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