Results 1 to 2 of 2

Thread: updating row source for charts in VBA [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Resolved updating row source for charts in VBA [RESOLVED]

    ok,

    i have a selection of charts on a spreadsheet.

    e.g. charts(1) to charts(12)

    i have a combo box which has numbers 1 to 52, for each week of the month.

    I want the charts row source to be updated when a week is selected from the drop down. I dont want to change the column or source sheet, just the rows.

    is there any easy way to do this? or will i have to read the current source into a string and manipulate it?

    i was messing about with this:
    [2nd Edit to incorporate both chart plots]
    VB Code:
    1. For MyCount = 1 To 12
    2.     Charts(MyCount).SeriesCollection(1).SourceData Source:=Sheets(1).Range("a1:a10"), _
    3.     PlotBy:=xlColumns
    4.     Charts(MyCount).SeriesCollection(2).SourceData Source:=Sheets(1).Range("a1:a10"), _
    5.     PlotBy:=xlColumns
    6. Next
    [EDIT]
    just adding my calculations to get start and end rows for selected week:
    VB Code:
    1. If SelectedWeek = 1 Then
    2.     StartRow = 3
    3.     EndRow = 9
    4.     Else
    5.         StartRow = ((SelectedWeek * 6) + 3) - 6
    6.         EndRow = (SelectedWeek * 6) + 3
    7. End If

    all i want to update in the above code is 1 and 10 row references.
    each chart has different source columns, but the same source rows so i dont want to hard code the range for each chart.

    TIA
    Last edited by Br1an_g; Apr 12th, 2005 at 10:41 AM. Reason: resolved
    if you fail to plan, you plan to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width