VB/Excel: Aligning primary and secondary axes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cloh
    New Member
    • Jul 2007
    • 41

    VB/Excel: Aligning primary and secondary axes

    Hi guys,

    I was wondering if there was a way to automatically scale either axis depending on which axis has the larger range. For example, if the primary axis automatically ranges between 10 and -10, and the secondary ranges between 15 and -5... the macro should automatically scale both axes to

    min = -10
    max = 15

    The reason for this is because I am generating some graphs (2 different chart types) automatically on BOTH axes, but I want them to overlap on the "0" value. Thanks in advance.
  • cloh
    New Member
    • Jul 2007
    • 41

    #2
    Also as a follow-up, is there a way to programmaticall y fix the size of the chart?
    i.e. if I want a chart 5 inches by 3 inches (or in pixels, it does not matter)

    Thanks for the help!

    Comment

    • cloh
      New Member
      • Jul 2007
      • 41

      #3
      In case anyone looks at this thread, after fiddling around with VB, I found that if you type in

      Sheets(Sheetnam e).ChartObjects .Add _
      (left:=left, top:=top, width:=width, height:=height)

      and specify the values for the dimensions, you can set the size of your resulting chart.

      Comment

      Working...