Hello All,
I am using Excel 2007. I have an XY Scatter graph and I need to move the x and y axis titles further away from the axis. I also need to set the for center alignment is both the horizontal and vertical directions.
I tried using the macro recorder, but this has become somewhat useless in 2007. All I got was:
From this I have deduced I can move the axis labels by
It would be nice if there is a way just to move the axis label away by a specific distance. Then I would not have worry about centering and alignment.
Assuming I need to set the alignment and positioning I tried the following to give me center alignment in both directions.
Unfortunately when I looked at the alignment (via a format axis dialog box) it never changed. Using this method I will have to generate a size long enough to handle any label I might need.
On a side note, I have been reviewing "Excel VBA 2007 Programmer's Reference". Is the a more reader friendly book?
Thanks.
Mike Virostko
I am using Excel 2007. I have an XY Scatter graph and I need to move the x and y axis titles further away from the axis. I also need to set the for center alignment is both the horizontal and vertical directions.
I tried using the macro recorder, but this has become somewhat useless in 2007. All I got was:
Code:
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
Selection.Left = 373.38
Selection.Top = 483.492
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveSheet.ChartObjects("Chart 1").Activate
Selection.Left = 22.684
Selection.Top = 194.722
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Legend.Select
ActiveSheet.ChartObjects("Chart 1").Activate
Selection.Height = 81.356
Selection.Left = 210.734
Selection.Top = 251.821
Selection.Width = 528.265
From this I have deduced I can move the axis labels by
Code:
ActiveChart.Axes(xlValue).AxisTitle.Left = 10
ActiveChart.Axes(xlValue).AxisTitle.Top = 200
ActiveChart.Axes(xlCategory).AxisTitle.Left = 200
ActiveChart.Axes(xlCategory).AxisTitle.Top = 500
It would be nice if there is a way just to move the axis label away by a specific distance. Then I would not have worry about centering and alignment.
Assuming I need to set the alignment and positioning I tried the following to give me center alignment in both directions.
Code:
ActiveChart.Axes(xlValue).AxisTitle.VerticalAlignment = xlCenter
ActiveChart.Axes(xlValue).AxisTitle.HorizontalAlignment = xlCenter
Unfortunately when I looked at the alignment (via a format axis dialog box) it never changed. Using this method I will have to generate a size long enough to handle any label I might need.
On a side note, I have been reviewing "Excel VBA 2007 Programmer's Reference". Is the a more reader friendly book?
Thanks.
Mike Virostko