+ Reply to Thread
Results 1 to 9 of 9

Updating Charts

Hybrid View

Mordred Updating Charts 12-21-2010, 05:19 PM
Andy Pope Re: Updating Charts 12-22-2010, 06:37 AM
Mordred Re: Updating Charts 12-22-2010, 11:31 AM
Mordred Re: Updating Charts 12-23-2010, 11:09 AM
Andy Pope Re: Updating Charts 12-23-2010, 11:11 AM
Mordred Re: Updating Charts 12-23-2010, 12:02 PM
Mordred Re: Updating Charts 12-23-2010, 01:43 PM
Andy Pope Re: Updating Charts 12-24-2010, 07:11 AM
Mordred Re: Updating Charts 12-24-2010, 10:04 AM
  1. #1
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Updating Charts

    Hi all,

    Just wondering if someone can point me to a thread or give me advice on how to have a chart update its values after the data ranges have been updated? Specifically, I have a sheet that gets updated monthly, adding the new months data for that update. How can I apply this kind of logic to charts? Here's the recorded macro I have:
        Charts.Add
        ActiveChart.ChartType = xlLine
        ActiveChart.SetSourceData Source:=Sheets("Graphs").Range("L4"), PlotBy:= _
            xlRows
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(1).XValues = "=Monthly!R5C6:R5C65"
        ActiveChart.SeriesCollection(1).Values = "=Monthly!R7C6:R7C62"
        ActiveChart.SeriesCollection(1).Name = "=Monthly!R7C5"
        ActiveChart.SeriesCollection(2).Values = "=Monthly!R8C6:R8C62"
        ActiveChart.SeriesCollection(2).Name = "=Monthly!R8C5"
        ActiveChart.SeriesCollection(3).Values = "=Monthly!R9C6:R9C62"
        ActiveChart.SeriesCollection(3).Name = "=Monthly!R9C5"
        ActiveChart.SeriesCollection(4).Values = "=Monthly!R10C6:R10C62"
        ActiveChart.SeriesCollection(4).Name = "=Monthly!R10C5"
        ActiveChart.SeriesCollection(5).Values = "=Monthly!R11C6:R11C62"
        ActiveChart.SeriesCollection(5).Name = "=Monthly!R11C5"
        ActiveChart.Location Where:=xlLocationAsObject, Name:="Graphs"
        With ActiveChart
            .HasTitle = True
            .ChartTitle.Characters.Text = "Chart 1 Inustry Price Index"
            .Axes(xlCategory, xlPrimary).HasTitle = False
            .Axes(xlValue, xlPrimary).HasTitle = False
        End With
        ActiveChart.Legend.Select
        Selection.Position = xlBottom
        ActiveChart.PlotArea.Select
    Thankee big-big!
    Last edited by Mordred; 12-24-2010 at 10:03 AM.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Updating Charts

    You can use named ranges in order to have dynamic charts.
    http://peltiertech.com/Excel/Charts/Dynamics.html
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Updating Charts

    Thanks Andy, I've been exploring other threads and especially, looking at your website. I think I'll be able to come up with something today (if IT can fix my computer).

  4. #4
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Updating Charts

    Hi Andy, I've been trying to implement your scroller.xls into one of our workbooks but am having troubles. Particularly with regards to the "SCROLL_LABELS" and "SCROLL_DATA". In your file, you have this commented out:
    'OFFSET(Sheet1!$B$1,Sheet1!$E$2,0,Sheet1!$E$3,1)
    You state the data set in your example references these named ranges and I get that. What I do not get is where this formula is in the workbook? When I look at the screen shot you provide, the "Values:" has:
    scroller.xls!SCROLL_DATA
    but I do not see where you set the formula for "SCROLL_DATA". I am confusing my issue here I think but I have been trying to figure this out without much luck. Can you please point me in the right direction on this?

    Kindest Regards:

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Updating Charts

    in xl2003 use Insert > Names > Define
    in xl2007 use Formula > Name Manager

    You will find the names there.

  6. #6
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Updating Charts

    Hi Andy, thanks so far for your help. I'm not quite understanding the formula now. I now that you have yours set up to scroll down the rows but what about if I need to go across the columns? I've attached a small workbook with one field that I am trying to emulate from your example but there is no data showing up. I don't mean to be a pain in your behind but I have trouble understanding spreadsheet formulas.
    Attached Files Attached Files
    Last edited by Mordred; 12-23-2010 at 01:51 PM.

  7. #7
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Updating Charts

    Ok, so I changed the formula a bit so that it looks like this:
    SCROLL_DATA '=OFFSET(Sheet1!$C$6:$N$6,0,Sheet1!$B$1)
    SCROLL_LABEL '=OFFSET(Sheet1!$C$5:$N$5,0,Sheet1!$B$1,1)
    Now the problem is this: I can get the axis to display months (Jan Feb ...) or Years ( 2006 2007...) but not both. The user would want months and years. Tips?

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Updating Charts

    Because you have the year in merged cells it would be best to create the month/year date in the cells above the current data table.
    So enter the dates in row 3.

    Then alter your named ranges.

    SCROLL_LABEL: =OFFSET(Sheet1!$C$3,0,Sheet1!$B$1,1,Sheet1!$C$1)
    SCROLL_DATA: =OFFSET(SCROLL_LABEL,3,0)
    Attached Files Attached Files

  9. #9
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Updating Charts

    Thank you very much Andy. We have so much historical data that has not been graphed but now it will be, which will make my department a happy department.

+ 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