View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Programming for Excel Charts

Is startmonth a date, or a string containing a month name? If It's a
nonnumeric and non-date string, it didn't work in 2003 either.

In the Format Axis dialog, Excel 2003 and earlier allowed you to enter min
and max for any axis as numbers, dates, times, whatever you had. Excel 2007
allows a date scale axis to be controlled using dates only (no numbers), and
value axes to be controlled using numbers only (no dates and times). I don't
know if the problem extends to VBA. I doubt it, but you never know.

If this is a value axis and your scale parameters are dates, try converting
them to numbers, using CDbl(startmonth) etc.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"AstroProg" wrote in message
...
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