View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
AstroProg AstroProg is offline
external usenet poster
 
Posts: 3
Default Programming for Excel Charts

A Macro won't work here. The min and max for the x axis of the graph change
each month, so they need to determined by using code to go through a list of
dates.

"Joel" wrote:

I don't have Excel 2007 but I usually solve these problems by using the Macro
Recorder. Start Recording a macro and then make the scale changes manually.
Highlight the axis with the mouse and then double click to bring up scale
properties. Make the change you want and then stop recording.

"AstroProg" wrote:

The code below gives a Type Mismatch error on the .MinimumScale = startmonth
and the line afterward. This worked in Excel 2003 but gives the error in
Excel 2007. It appears you cannot use a string with the MinimumScale command.

Any ideas how to work around this? startmonth and stopmonth are dates such
as 01/01 and 01/31. Below is the VBA code.

Chart1.Activate
ActiveChart.Axes(xlCategory).Select
With ActiveChart.Axes(xlCategory)
.MinimumScaleIsAuto = False
.MaximumScaleIsAuto = False
.MinimumScale = startmonth
.MaximumScale = endmonth