+ Reply to Thread
Results 1 to 3 of 3

using checkboxes to plot certain data series on one plot

  1. #1
    Registered User
    Join Date
    07-03-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    23

    using checkboxes to plot certain data series on one plot

    Hi - this post is not as long as it seems, I've included some code for reference so please keep reading

    I have a bunch of data sheets that are identical in format (other than the number of rows). I'm trying to make a bunch of different graphs for the data sheet (same graphs for each worksheet). In order to make comparing data series easier, I'm trying to have a list of check boxes representing all of my different worksheets, and through these checkboxes, be able to select which of these data series I want to plot on the same graph.
    To keep things simple, I've just been trying to work with two worksheets and one graph.

    This is the code for my first checkbox (which works okay on it's own):

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    My second checkbox is the one giving me problems...I think I've done a few things wrong here, but I'm a complete rookie and am not sure how to go about fixing them.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    - For starters, I get a subscript out of range error for the line Charts("Chart1").Activate
    - I don't know how to set up my code so that if FB1 data is not selected, I still create a plot (without creating two plots by adding a chart in the checkbox 2 code)
    - Another thing that is kind of annoying is that the second i select the checkbox for my first data sheet, excel graphs it and jumps to the "plots" worksheet so i have to go back to my grapher sheet to select another series to graph...should i just activate the graphical control sheet at the end of my code? it would be better if i could implement a command button that is linked to the selection of check boxes so that the selection boxes don't execute an action the second they're clicked
    - is it possible to have a "select" function with different cases for all my checkboxes rather than having a different sub for each? I think this would be best, then I could maybe create the shell for a graph before selecting which data series to plot...

    I'll post updates as I change things around. If someone could just point me in the right direction as to how to structure this sort of idea that would be great. I have some coding experience, just not with VBA.

    Thanks in advance,

    Dan

  2. #2
    Registered User
    Join Date
    07-03-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: using checkboxes to plot certain data series on one plot

    So i just changed:

    Charts("Chart1").Activate

    to

    Worksheets("Plots").Charts("Chart1").Activate

    I also initialized my SheetName2 worksheet variable with

    Dim SheetName2 As Worksheet

    and I get a different error - Object doesn't support this property or method
    Last edited by chemeng1T3; 07-10-2012 at 06:58 AM.

  3. #3
    Registered User
    Join Date
    07-03-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: using checkboxes to plot certain data series on one plot

    Not sure if this is the most condensed way to do it, but this works. I created a macro for the command button, referencing the check boxes

    Formula: copy to clipboard
    Please Login or Register  to view this content.

+ 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