views:

1098

answers:

3

I'd like the X and Y axes of my Excel charts to have the same scale on the screen, because I'm plotting geographical data. A 1km by 1km square should look like a square, not like a rectangle, i.e. no squishing of the map in one or the other direction. In Matlab, the command that would do this is axis equal.

How do I do this using VBA? (I've never manipulated charts using VBA.)

Am I overlooking an even simpler solution directly in Excel?

A: 

right-click on each axis and change the max and min values to make them equal the other axis. You will need to do this for each axis.

guitarthrower
This doesn't solve my problem at all.
JF
Also, I don't want to right-click and manually fiddle around in "Chart options" for all my graphs, and start all over every time some new data is added to a chart!
JF
+1  A: 

In addition to guitarthrower's answer you will need to do the following: Select the 'Plot Area' of the chart and then manually set the height and width of the plot area.

Sheets("Chart1").PlotArea.Select
  Selection.Height = 500
  Selection.Width = 500

Just setting the axis min and max values will still allow the chart to be 'squished'.

Stewbob
+2  A: 

StewBob's approach is refined in the code posted on this page: Make Gridlines Square

Jon Peltier
Thanks. U da man.
JF