+ Reply to Thread
Results 1 to 9 of 9

Chart displayed is selected via a dropdown menu

  1. #1
    Registered User
    Join Date
    05-14-2008
    Posts
    7

    Chart displayed is selected via a dropdown menu

    I have a workbook with several sheets of data and charts... I want to be able to hide all of the data sheets and individual charts so that when someone opens the workbook they only see a single sheet. I want the individual that opens the workbook to select from a dropdown menu and *poof* that chart is displated on the "front page".... I am pretty proficient with Excel, but not with VBA or the use of Macros. I found the below code, which appears todo want I want.... But it doesn't work. Is there something that I need todo in order for the code to "run"? I need to be able to send these files to others and have it work without them doing anything "special"....

    The code I found...
    Please Login or Register  to view this content.

    Thanks!
    Buster
    Last edited by royUK; 05-14-2008 at 03:51 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Buster, please read the Forum Rules and use Code Tags in future. I will add them for you this time.

    Have you amended the code to work with your sheet & chart names?
    Last edited by royUK; 05-14-2008 at 03:52 AM.
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    05-14-2008
    Posts
    7
    Quote Originally Posted by royUK
    Buster, please read the Forum Rules and use Code Tags in future. I will add them for you this time.

    Have you amended the code to work with your sheet & chart names?
    I have read the forum rules.... Thanks for the help with wraping my code and making it appear as the rules state. I do not know anything about VBA/code so I was unsure what I really needed todo in order to follow the rules.

    So, as I posted before, I am not even at the novice level with VBA...

    I did amend the code to work with my sheets and charts.... That did not work, so I built a chart/sheet combo based on the VBA code that I found, and that does not work either.

    I don't know if I need todo this or not, but when I compile the code, it tells me that there is an invalid use of Me on the first instance of it. Since I don't know what a valid use is, I am lost already.

    Is there something that I need todo in order for the code to run?

    I have attached the xls file with the sample that I built based on the code that I found...

    Thanks for all of the help!
    Buster
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Your error is because you placed the worksheet code in a standard module. I'll take a look at it later

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've moved the code & changed it slightly
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-14-2008
    Posts
    7
    Quote Originally Posted by royUK
    I've moved the code & changed it slightly
    royUK,

    It works! So what did I do wrong as I build the code into the sheet/combo chart that I have? You said I placed it in a standard module, I just used the insert module from the editor, what do I need to do?

    Thanks for the help!

    Buster

    EDIT
    --------------------------------------------
    I figured it out!! I needed to view the code for the sheet and then add the VBA there.....

    This is pretty powerful stuff!!! I need to figure out how todo more of this in Excel.

    Again, thanks for the help!
    Last edited by Buster1320; 05-14-2008 at 02:45 PM.

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    How about a non vba vesion?
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  8. #8
    Registered User
    Join Date
    05-14-2008
    Posts
    7
    Quote Originally Posted by Andy Pope
    How about a non vba vesion?
    Andy,

    That works also! I looked at the sheet that you attached, how did you get the drop down list to grab the chart?? I looked for functions and such and could not find the "trick"...

    Thanks!
    Buster

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    There are 3 named ranges.

    CHARTA: =Sheet1!$D$3:$L$21
    CHARTB: =Sheet2!$D$3:$L$21
    USECHART: =INDIRECT(Sheet3!$J$2)

    The data validation displays CHARTA or CHARTB, which is used by the indirect formula.

    The names reference the areas covered by the charts on sheets 1 and 2.

    The thing displaying the charts is a picture object that has been linked via the formula bar to =USECHART

    To create the link select any picture and in the formula bar enter =USECHART

+ 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