To do this neatly, you do need to use a dynamic range so that you can easily determine the last point actually populated.
In the attached (Data Series Formatting with a Dynamic Range.xlsm):
- See the named calculated range 'TestSeries' and see how it adjusts in size according to the number of entries
- Also see how the dynamic named range is used instead of a normal range reference in chart data setup.
- The last point of the series has been set as MarkerStyle = circle.
- Now enter a new value in the chart data, you'll see the line extend, BUT your point is illustrated - the marker is now on the 2nd last point.
- Now click the button, and the formatting is restored.
The work for refreshing the series formatting is done by this proc:
Aargh. Ignore the extra proc 'Private Sub SetChartData' in the module; I didn't clean up before posting.
Bookmarks