PDA

View Full Version : ChartSpace not changing correctly



visserdw
05-10-2011, 06:13 AM
Hi,

I am having problems with the VBA ChartSpace function and would greatly appreciate your help.

My code is as follows:

Private Sub AmountSub_Change()

Dim Myarray_x(4) As Long
Dim Myarray_y(4) As Long

Myarray_x(0) = -20
Myarray_x(1) = 20
Myarray_x(2) = -20
Myarray_x(3) = 20

Myarray_y(0) = -20
Myarray_y(1) = 20
Myarray_y(2) = 20
Myarray_y(3) = -20

With DefaultConfig.Charts(0).SeriesCollection("Series 1")
.SetData chDimXValues, chDataLiteral, Myarray_x
.SetData chDimYValues, chDataLiteral, Myarray_y
End With

With AltConfig.Charts(0).SeriesCollection("Series 1")
.SetData chDimXValues, chDataLiteral, Myarray_x
.SetData chDimYValues, chDataLiteral, Myarray_y
End With

End Sub


I Have Created a User Form and inserted two chart spaces (DefaultConfig and AltConfig) I have set them both up according to a default specification (See Figure 1 in attachment). If the dropdown box is changed, I want the chart to change the configuration to four dots in each corner of the chart (Coordinates are in the code).

My Default initial input is shown in the second Figure in the attachment

But when I change the Combo Box value I am getting a output as shown In the third figure of the attachment. This does not match the coordinates I input from the code.

I have tried everything and cannot fix this problem. I will appreciate your expertise.

Thank you