Excel 2003 to 2007 VBA Change

A

AstroProg

I was testing some Excel 2003 spreadsheets with Visual Basic programming, and
found one that does not work in Excel 2007.

The code below gives a Type Mismatch error on the .MinimumScale = startmonth
and the line afterward. It looks like in Excel 2007, you cannot use a string
this way with the MinimumScale command.

Startmonth and Stopmonth are dates from the beginning and the end of a month
that are determined by a routine that goes through a list of dates until it
finds these values. startmonth and stopmonth would have values like 01/01
and 01/31. This section of programming sets up the x axis of the graph using
startmonth and stopmonth as the x axis min and max.

I am way out of practice with Visual Basic programming, so any help would be
greatly appreciated.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top