View Single Post
  #1   Report Post  
Jon Peltier
 
Posts: n/a
Default Secondary axis with VBA

You replied to the wrong thread.

Sometimes putting .ChartType up too high will cause an error. If you specify a
bubble of stock chart type before specifying enough data to populate that chart
type, it will crash.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

tubbinator wrote:

Got a reply off of the Excel-L mailing list. Had to move the
".ChartType = xlLine" line up higher. Moved it to right after chart
creation. I could have sworn I'd gotten errors with that line up
higher before. Oh well.

Tubbs


Jon Peltier wrote:

Didn't you step through the code? Your chart had a secondary axis until
the end when you ran this line:

.ChartType = xlLine

The xlLine chart type by default has only primary axes, so running this
line obliterated the axis you worked so hard to construct. Move the line
to the top, right after this:

With ActiveSheet.ChartObjects(1).Chart

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

tubbinator wrote:

I'm using the following VBA code and I never see the secondary value
axis. Can anyone figure out why???

Excel 2003, VBA

Thanks,
Tubbs


Code: