Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Change minimumscale with the change event of a combobox

Hello,

I'm using Excel97 and Windows 98SE.

I have a chart in a a worksheet in a workbook and there is a combobox on the
same worksheet 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Change minimumscale with the change event of a combobox

There's a bug in xl97 (fixed in xl2k) that deals with code called from controls
from the control toolbox toolbar that are used on a worksheet.

One fix is to change the .takefocusonclick property to false.

Another fix is to add:
activecell.activate
at the top of your code.

since the comboboxes don't have the .takefocusonclick property, you can use the
second suggestion.



Herbert Chan wrote:

Hello,

I'm using Excel97 and Windows 98SE.

I have a chart in a a worksheet in a workbook and there is a combobox on the
same worksheet 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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM
combobox change event scrabtree23[_2_] Excel Programming 3 October 20th 03 05:56 PM
Generic ComboBox change event steve Excel Programming 7 October 14th 03 07:30 PM
Combobox Change Event when file is saved as E.Anderegg Excel Programming 1 October 1st 03 05:03 PM
Excel 2000 ComboBox Code Change event Matt. Excel Programming 3 July 28th 03 03:29 PM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"