Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No, With/End With is a very handy construction in VB, and can be used anywhere a
block of code would otherwise have lots of repetition of the same object references. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Nick Bennett wrote: Jon Peltier wrote in message ... Nick - SetSourceData tells the chart what its entire range should be. This is fine if the ranges are all neatly aligned, and all series use the same range for their X values. Thanks for that: it's what I suspected, hence the need for some kind of series-specific code! What you need is to set the X and Y ranges for each series separately: With Chart(1).SeriesCollection(1) .Values = Worksheets("DataSet").Range("AI3:AI28") .XValues = Worksheets("DataSet").Range("AH3:AH28") .Name = Worksheets("DataSet").Range("AI2") End With With a little tweaking I think I've got it to work: minor hiccup though, it should read With ChartS(1)... which had me head-scratching for a bit ;-) I was under the impression that the With commands were only for setting up a chart at the start of a program or something, but it seems reasonably happy with changing it on the fly. Note for any readers with the same/similar problems that I expect it only works if you've already established a series the the sort of errors I was getting imply that unless you've previously established a NewSeries with a range etc you can't then go in and change it - since my chart and series pre-exists that criteria is filled. This is probably obvious to anyone with much experience with VBA but I'm learning as I go! I'm pretty sure I should be okay from here on. Thanks very much for the assistance. Cheers Bennett |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2000: Changing path of an external data source | Excel Discussion (Misc queries) | |||
Changing a Data Source in Excel 2000 | Excel Discussion (Misc queries) | |||
Changing series information for approximately 60 series in a workb | Charts and Charting in Excel | |||
Excel changing number formatting and source data in graphs on it's own!!! | Excel Discussion (Misc queries) | |||
VBA Excel - changing series source. | Excel Programming |