+ Reply to Thread
Results 1 to 4 of 4

Hiding and Unhiding Charts

  1. #1
    Registered User
    Join Date
    05-03-2012
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    19

    Hiding and Unhiding Charts

    Hi,

    I am trying to set up a portion of a worksheet so that when I click a checkbox, a chart with a historical timeseries will show up. For example, I have a checkbox that says Price, so when I click that checkbox I'd like a chart with the price time series to show up.

    I have pretty much everything set up - the only thing I don't know how to do is to write the macro to make the chart visible/hidden.

    Ideally, since the checkboxes already generate a TRUE/FALSE statement, I would just link the macro to that cell, so that it was something along the lines of:
    ActiveSheet.ChartObjects("Price Chart").Visible = TRUE/FALSE

    However I can't get anything like that to work. The cell linked to the checkbox, and the underlying data, are on a separate tab than where I'm trying to get the charts to show up.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Hiding and Unhiding Charts

    First, make sure that you're using a CheckBox from the ActiveX controls. Then, let's say that Sheet2 contains your chart, and that you've placed the CheckBox on Sheet1. Right-click the sheet tab for Sheet1, select 'View Code', and place the following code in the code module for the sheet...

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-03-2012
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Hiding and Unhiding Charts

    Thanks for the quick reply Domenic - unfortunately that doesn't seem to be working for me. I switched over to an ActiveX control, and copied in your code (changing the sheet names). Nothing happens.

    I don't think this matters, but I think I was unclear before as well, the checkbox and the chart are on the same sheet, it is only the cell that I linked to the checkbox that is on a different sheet. The data for the chart is being pulled in from an outside data vendor, and is on "Sheet 2", whereas the chart and checkbox are on "Sheet 1". I linked a cell on Sheet 2 to the checkbox, so that the true/false value in that cell will cause the data to be pulled in or not.

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Hiding and Unhiding Charts

    Have a look at the attached file. Does it help?
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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