+ Reply to Thread
Results 1 to 3 of 3

Multi Select Slicers - Pulling back selected items VBA

  1. #1
    Registered User
    Join Date
    07-05-2016
    Location
    Nottingham
    MS-Off Ver
    2010
    Posts
    11

    Multi Select Slicers - Pulling back selected items VBA

    Hi,

    I have a table with 3 slicers, Supplier, Seg 1 and Seg 2.

    A chart is created based on the selection in the slicers. I am wishing to generate a chart title from the selections. Everything works until the multi-select option is enabled. My code just brings back all items in the lists including hidden ones. Please can anyone help? This is my code (bit of a novice so please excuse if its crude!) for pulling back the selected items from a slicer - works great unless multi-select is on.

    Set MySlicerCache = ActiveWorkbook.SlicerCaches(1)
    n = 0
    For i = 1 To MySlicerCache.SlicerItems.Count
    With MySlicerCache.SlicerItems(i)
    If .Selected = True Then
    strGraphTitle1 = strGraphTitle1 & .Value & ", "
    n = n + 1
    End If

    End With
    Next i
    If n = MySlicerCache.SlicerItems.Count Then
    strGraphTitle1 = "ALL Suppliers"
    Else
    strGraphTitle1 = Left(strGraphTitle1, Len(strGraphTitle1) - 2)
    End If

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,574

    Re: Multi Select Slicers - Pulling back selected items VBA

    That code works fine for me whether or not multi-select is on.

    Any chance you could upload a sample workbook?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-05-2016
    Location
    Nottingham
    MS-Off Ver
    2010
    Posts
    11

    Re: Multi Select Slicers - Pulling back selected items VBA

    Thank you. I can't share the data, unfortunately - I will try and recreate the problem with other data tomorrow. :-)

+ 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. Print Items From Multi-Select Listbox
    By bobgodfrey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2017, 11:18 AM
  2. [SOLVED] Caption Multi Selected Items from Listbox to Label (One in Each Line)
    By boss1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2014, 09:12 AM
  3. actionbased multi selected items in listbox
    By mido609 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2013, 11:42 AM
  4. [SOLVED] Trying to copy selected items from sheet to listbox then selected back to sheet
    By BigWes1960 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 03-14-2013, 03:27 PM
  5. [SOLVED] Find Multi Selected Items in Listbox in Range
    By Sniper in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2012, 07:53 AM
  6. multi select listbox, remove selected items.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-25-2009, 08:39 AM

Tags for this Thread

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