Change minimumscale with the change event of a combobox

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Herbert Chan (Herbert_at_Chan.com)
Date: 04/11/04


Date: Sun, 11 Apr 2004 14:39:22 +0800

Hello,

I'm using Excel97 and Windows 98SE.

I have a chart in a a work*** in a workbook and there is a combobox on the
same work*** to control which series to be plotted on the chart.

I want to be able to change the minimumscale of the chart with respect to
the minimum value to be plotted and I'd like to have control over it rather
than leaving it up to Excel's auto feature.

I've tried the following code but it gave me error 1004:

Private Sub ComboBox1_Change()
Sheets("Chart").ChartObjects(1).Chart.Axes(xlValue).MinimumScale =
Sheets("Chart").ChartObjects(1).Chart.Axes(xlValue).MinimumScale / 3
End Sub

(Please forget about the fact that the scale will be diminished every time
the combobox is changed. I just want to figure out how to be able to change
the minimumscale first.)

However, the following code can run:

Sub testaxis()
Sheets("Chart").ChartObjects(1).Chart.Axes(xlValue).MinimumScale =
Sheets("Chart").ChartObjects(1).Chart.Axes(xlValue).MinimumScale / 3
End Sub

That is: I can run the testaxis macro, but get an error of 1004 if I make
changes to the combobox and combobox1_change() is invoked.

Can anyone tell me what is wrong and what I should do?

Thanks.

Herbert


Quantcast