+ Reply to Thread
Results 1 to 11 of 11

VBA for filtering a slicer with a cell condition

  1. #1
    Registered User
    Join Date
    08-11-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    52

    VBA for filtering a slicer with a cell condition

    Hi,

    just a quick help for someone that has no clue about where to start in VBA.

    I want to change the slicer with respect to what is written in cell A3. I'd appreciate very much your help.

    Vasco
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA for filtering a slicer with a cell condition

    No doubt better methods - not something I'm familiar with I confess...

    Please Login or Register  to view this content.
    the above would be stored in Sheet1 within VBE

  3. #3
    Registered User
    Join Date
    08-11-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: VBA for filtering a slicer with a cell condition

    Hi,

    the code worked beautifully on that workbook. Unfortunately for some reason I'm working in a different workbook (that is 23MB large) and the code doesn't work there.

    I am getting an error in this line:
    With ActiveWorkbook.SlicerCaches("Slicer_country")

    I see 2 reasons for this to happen:
    - I have another slicer on the same sheet
    - The slicer is connected to data from different sheets

    Any idea on how to fix this?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA for filtering a slicer with a cell condition

    To be honest I have no real experience using Slicers.

    From a Slicer Pivot perspective I would have assumed that for two pivots to share a Slicer they must be sourced from the same Pivot Cache - you imply this not to be the case.

    In your real file is the Slicer cache named Slicer_Country ? [ie slicer is called Country]

  5. #5
    Registered User
    Join Date
    08-11-2010
    Location
    Stockholm
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: VBA for filtering a slicer with a cell condition

    Hi,

    thanks for helping out. So, the slicer is called Country (therefore Slicer_Country). Can this bedifferent from the slicer cache?

    Vasco

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: VBA for filtering a slicer with a cell condition

    As mentioned I can't replicate the issue you're having and I can't create a Pivot Slicer from two different data sources [but again I know very little about them]

    It might be an idea to post a sample that illustrates the error "in action"

  7. #7
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: VBA for filtering a slicer with a cell condition

    Gostam

    Please take some time to read forum rules - Especially concerning hijacking and mod requests

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: VBA for filtering a slicer with a cell condition

    Gostam

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

    If you break the Forum Rules one more time then you will not be allowed to use the Forum
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  9. #9
    Registered User
    Join Date
    06-22-2012
    Location
    Utah
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: VBA for filtering a slicer with a cell condition

    I know nothing about VBA, but this is exactly what I need to do. I tried copying and pasting the VBA code that DonkeyOte posted into the visual basic in my Excel spreadsheet, but it didn't work. is there something missing from the VBA code that is preventing it from working properly?

  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: VBA for filtering a slicer with a cell condition

    Welcome to the Forum, hankbon, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

    You must have seen the posts above where some one else had been admonished previously but you did it anyway!
    Last edited by protonLeah; 06-22-2012 at 11:48 PM.
    Ben Van Johnson

  11. #11
    Registered User
    Join Date
    04-21-2019
    Location
    Maldives
    MS-Off Ver
    excel 2016
    Posts
    1

    Re: VBA for filtering a slicer with a cell condition

    Dear

    Can anyone help me on How to i connect my Dropdown with Slicer in the sheet.
    My Dropdown is in "AB2"
    Slicer is for the Sales Personwise.

    I need when i change my Drop down list to someone, All the data to be change as per that to my slicer as my slicer is connected to Pivot table

    Anyone can help would be great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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