I have an assignment in an Excel VBA macro
axscty = ax.ScaleType
which gives the error: "Method 'ScaleType' of object 'Axis' failed".
I found sources stating that it is a bug in Excel 2007. Others found the error when setting .ScaleType
, e.g.,
.ScaleType = xlLinear
I have found the cause of the error: I have a secondary Y-axis with data series. If I assign those series to the primary Y-axis and remove the secondary axis, the error disappears.
Anyone knows how to avoid the error when there is a secondary Y-axis?
It looks like the following works (if you have any secondary axis or not):