Hi, I am writing a compose an Excel spreadsheet. It needs to retrieve a few lines of record from a database and then display the data as curves in a chart. So far, I can get required records to excel Sheet_A by clicking a button on Sheet_B. I can also manually produce a Chart_C in Sheet_A myself. What I need to do now is to update the data source when the button on Sheet_B is clicked, am I right now?
If I have two curves on Chart_C, my code is like the following: ----------------- ' suppose nSheet and numRow below are variables initialized already ' Dim achart As ChartObject For Each achart In ActiveSheet.ChartObjects() achart.SeriesCollection(1).XValues = "=" & nsheet & "!R2C1:R" & numRow & "C1" achart.SeriesCollection(1).Values = "=" & nsheet & "!R2C2:R" & numRow & "C2" achart.SeriesCollection(2).XValues = "=" & nsheet & "!R2C1:R" & numRow & "C1" achart.SeriesCollection(2).Values = "=" & nsheet & "!R2C2:R" & numRow & "C2" Next achart ---------------- Why I get error message: "Object does not support this property or method", while the debugger points to the first line in the above loop? I am using Excel 2000 now. I only have two charts, each on a separate sheet. The above loop seems redundant. How can I specify an existing chart using VBA? Thank you for your help, -Kevin --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com -~----------~----~----~----~------~----~------~--~---