HELP!!!!!!!!!! VBA charts

S

silvia

Hi!
I need help with a program in Excell 2000.
I have inserted a Chart Space in an userform in VBA (Microsoft Office
Chart 9.0) Then, I started to write the code for the chart, like this:

Private Sub ChartSpace1_DataSetChange()
End Sub
Sub CreateChart()
Dim Chart1 As WCChart
Dim Series1 As WCSeries
Dim r As Integer
Dim XValues(1 To 23)
Dim DataValues(1 To 23)
ChartSpace1.Clear
' Add a graph to ChartSpace1
Set Chart1 = ChartSpace1.Charts.Add
' Give it a title
With Chart1
HasTitle = True
If OptionButton1 Then
Title.Caption = Cells(1, 3)
ElseIf OptionButton2 Then
Title.Caption = Cells(1, 4)
ElseIf OptionButton3 Then
Title.Caption = Cells(1, 5)
Else
Title.Caption = "FET,P and T"
End If
End With
' Obtain the categories and the values of the graph
For r = 2 To 24
XValues(r - 1) = Cells(r, 2)
If OptionButton1 Then
DataValues(r - 1) = Cells(r, 3)
ElseIf OptionButton2 Then
DataValues(r - 1) = Cells(r, 4)
ElseIf OptionButton3 Then
DataValues(r - 1) = Cells(r, 5)
Else
'DataValues(r-1)=Cells(r,3 to 5)
End If

Next r
' Create a serie of graphs
Set Series1 = Chart1.SeriesCollection.Add
' Specify the type of graph and the data
With Series1
Type = chchartTypeXYScatter

SetData chDimValues, chDataLiteral, "B2: B24"

SetData chDimValues, chDataLiteral, DataValues

End With
End Sub


The problem is that when I run the program, it says:

Compile error: Can't find project or library

PLEASE CAN ANYONE HELP ME???????????

Thanks in advance
Silvia
 

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

Similar Threads

Charts with Combobox 2
Chartspace & Excel2003 0
Need help in printing vba code 0
external links 2
R1C1 1
Print Directory to Excel 13
Replacing 0 value with empty 8
Delete Rows Based on Words 2

Top