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?
Dim ax as Axis
,Set ax = myChart.Axes(xlValue)
. The only alternatives I see are: 1) UsingxlCategory
instead ofxlValue
, 2) Adding the second optional parameterAxisGroup
, asxlPrimary
orxlSecondary
. Can you point out the effect this can have on an answer? – sancho.s ReinstateMonicaCellio