+ Reply to Thread
Results 1 to 5 of 5

How do I add buttons on a chartsheet which controls the autofilter on the underlying data?

  1. #1
    Registered User
    Join Date
    04-02-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    How do I add buttons on a chartsheet which controls the autofilter on the underlying data?

    I have a excel chart sheet which portrays a line graph with about 10-12 series. I want to add buttons which will enable me to view the series that I want view. Adding filter to data enables you to do this, how do I add buttons the actual chart sheet linking them to the auto filter? Or a ActiveX control box which allow me to tick the series that I want, so controlling the autofilter through the Active X control checkbox on the chartsheet.

    Any help will be appreciated, thank you.
    Last edited by aab_489; 04-14-2014 at 06:29 AM.

  2. #2
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How do I add buttons on a chartsheet which controls the autofilter on the underlying d

    Hi aab,
    You can not add active-x to a chart sheet. But You can use classical combobox, listbox or buttons on chart sheet to get series name. After You know series name to be highlightet (visible), it is very simple to loop through all series and look for exact match and do some formating:

    'Dim chrt As Chart
    'Dim srs As Series
    'Set chrt = ActiveChart
    'For Each srs In chrt.SeriesCollection
    ' If srs.Name = "seriesname" Then
    ' srs.Format.Line.Weight = 3
    ' srs.Format.Line.ForeColor.RGB = RGB(r, g, b)
    ' Else
    ' srs.Format.Line.Weight = 1
    ' srs.Format.Line.ForeColor.RGB = RGB(192, 192, 192)
    ' End If
    ' Next srs

  3. #3
    Registered User
    Join Date
    04-02-2014
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How do I add buttons on a chartsheet which controls the autofilter on the underlying d

    Hi Miroslav,

    Thank you for your reply, much appreciated.

    Can you break it down for me further please? Apologies, I am new to VBA!

    If you hide rows in the underlying data of a chart, then it also "hides" that series on the chart which you hid in underlying data. I want to add check boxes to then chart sheet which will enable me to control which series I want to select and deselect so the graph doesn't look to congested.

  4. #4
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How do I add buttons on a chartsheet which controls the autofilter on the underlying d

    wait a min...
    You want a chart on excel worksheet together with source data table? Because this is different situation that I had replied to you earlier.
    Only way how to prevent hiding lines in chart when hiding rows is to fill that chart via VBA (chart.seriescollection.newseries). Before tahat, you have to clean the lines in chart. Something like this (I coppied this from my wbk, and you have to arrange it to Your conditions):
    CLEANING:
    Please Login or Register  to view this content.
    GET NEW SERIES NAME AND SOURCE RANGE FROM SHEET (you can put it in a loop or something). 'Ser' and ranges will be assingned according to you selection via button, dropdown etc...:
    Please Login or Register  to view this content.
    ADDING LINE TO CHART:
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How do I add buttons on a chartsheet which controls the autofilter on the underlying d

    and I forgot: put "hiding row" procedure below my code... :-)

+ 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. Replies: 0
    Last Post: 04-14-2014, 04:02 AM
  2. [SOLVED] Positioning. Form controls (Buttons)
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2012, 03:43 AM
  3. Replies: 1
    Last Post: 04-17-2009, 05:04 PM
  4. [SOLVED] Color of Commandbars Controls (buttons) when disabled
    By MrT in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2006, 01:05 PM
  5. Replies: 6
    Last Post: 01-18-2005, 12:06 PM

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