What my question ultimately boils down to is the following: Does anyone know how to make a secondary x-axis logarithmic
using VBA in Excel 2010? I cannot get the .ScaleType property to work. Some more information that may be helpful is given
I'm writing a macro that automates creation of a scatterplot, and I need to make both the primary and
secondary x-axes logarithmic. However, whenever I try to set the .ScaleType property for either x-axis through VBA using
the lines of code given below, I get an error that says "ScaleType of object Axis failed."
ch.Axes(xlCategory).ScaleType = xlScaleLogarithmic
ch.Axes(xlCategory, xlSecondary).ScaleType = xlScaleLogarithmic
'Note that ch simply refers to the chart that's being created
If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
I am aware that the .ScaleType property technically only applies to the y-axis, but I found out from some old posts in
another forum that this error will not get raised as long as .ScaleType is set immediately after all data has been added to
the plot. This solves my problem for the primary x-axis, but it is impossible to set this property for the secondary x-axis
immediately after all data is added to the plot because I have to add the secondary axis before trying to make the scale
logarithmic. Is there another way to get around this?