Hi,
I am writing a code, which would automatically set min and max scale for y-axis.
I have a chart, which adds new given values automatically (this is carried out using OFFSET and COUNTA-functions: the named ranges expand when adding new values, and the chart uses these dynamical areas.)
However, min and max scale of the y-axis don't change automatically (as I would like them to change.)
I'm quite a beginner with visual basic, but I finally managed to come out with this:
(This code is located in Modules: Module 3 - is this the right place?)
The code above is called by the next code (for example):
(The next code is located in Microsoft excel objects: Thisworkbook - Is this the right place?)
The previous example updates the scaling of the chart called "nameofthechart", and the difference between the maximum value (minimum value) and the y-maximum (y-minimum) scale is 10 percent.
Is this a practical way to carry this out? Would you prefer some other way to do this?
The code seems to work properly when there is just one data series in the chart. But when there is for example two data series (xy scatter), it gives an error message when adding values just to the other series (so that the series contain different number of records)
Debugger highlights the row
How could this be prevented?
Thank you!
Bookmarks