+ Reply to Thread
Results 1 to 8 of 8

A VBA code to select & show one chart from many

  1. #1
    Registered User
    Join Date
    02-02-2006
    Location
    Sydney . Australia
    MS-Off Ver
    2007 and 2013
    Posts
    98

    A VBA code to select & show one chart from many

    I have 9 charts, and to select & show one at a time, I used an image and assigned a formula to it, using a named range " getChart" and a Combo Box. This method works OK except that it is causing Excel to be so annoyingly sluggish.
    To overcome this sluggishness, I need a VBA code which sets the formula for the image ( forcing the chart to change) and deletes the formula from the image again to leave it ' static'.
    I've noticed that when I manually delete the formula, the selected chart stays and Excel sluggishness goes away completely, but without the formula no other chart can be selected. A sample workbook is attached
    Any help will be greatly appreciated.
    Attached Files Attached Files
    Last edited by Michael6; 11-03-2011 at 08:35 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: A VBA code to select & show one chart from many

    Maybe i could suggest something here.
    How about having one dynamic chart in a sheet which will change based on a dropdown. The data for each of the 9 charts will be somewhere on the sheet and as the dropdown changes, the data set for that respective chart will be activated and the chart will then source that data.
    This can be done using offset, index, match, etc. It can be a lil complicated to do but will save you time while using, as you do not have to work with 9 charts but 1.

  3. #3
    Registered User
    Join Date
    02-02-2006
    Location
    Sydney . Australia
    MS-Off Ver
    2007 and 2013
    Posts
    98

    Re: A VBA code to select & show one chart from many

    Thank you arlu 1201 for your suggestion. But it doesn't seem to be easy to follow. I had similar thoughts which I tried without success. I beleive there can be a VBA code to solve the problem.
    If you could elaborate on your suggestion I might see some points I am not aware of now.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: A VBA code to select & show one chart from many

    Find attached a sample of what my idea is (mentally). If you want, we can work together to achieve it.
    Or maybe if it requires VBA, we can work it out.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-02-2006
    Location
    Sydney . Australia
    MS-Off Ver
    2007 and 2013
    Posts
    98

    Re: A VBA code to select & show one chart from many

    arln1201, I really appreciate your trying to help. But I Actually explored different ways of manipulating the data as your suggestion implies, and couldn"t arrive at the outcome in mind.
    My VBA Knowledge is not much above zero. But, of what I know of it , I can see that a code can be written to achieve the required outcome.
    If you are familiar with VBA, it will be great to look into writing a code as I explained in my original post. Thank you very much.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: A VBA code to select & show one chart from many

    Ok. I have not worked much with VBA involving charts but maybe someone here can help you.

    Also, i opened your file and didnt find it very sluggish when i used the dropdown. It was pretty normal as the other workbooks i use. So maybe you can check your memory / RAM in the system and also if you have other workbooks open at the same time that are huge in size.

  7. #7
    Registered User
    Join Date
    02-02-2006
    Location
    Sydney . Australia
    MS-Off Ver
    2007 and 2013
    Posts
    98

    Re: A VBA code to select & show one chart from many

    arlu1201, thank you again.
    The charts are based on the data cotained in the sheet "Main" of the actual (original) workbook. Nothing of this data exists in the "Main" sheet of the sample workbook.I did not think it was necessary to include it . That is why the sluggishness of the original workbok is not showing in the sample workbook. I actually noticed this after uploading the file, and it occured to me that the problem won't be showing, and the smooth run of the sample workbook would be misleading.
    So, being aware of this, would you think it is possible to have a VBA code written to solve the problem of sluggishness in the actual workbook?

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: A VBA code to select & show one chart from many

    My expertise is limited with respect to vba & Charts. But someone here should be able to help you surely.

+ 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