LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Charts with Combobox

I am using a chart object and I want a comobobox or listbox to
activate what the graph shows. I am fairly new to this and I don't
think it should be too hard. I just can't seem to get the values into
the array correctly to display them. Also, if it is possible to
create one with a listbox and allow for multiple selections to be
displayed on the graph that would be preferable.

Thanks,
Andrew

Here's what I am trying to do:

Sub Combobox1_Click()
Call CreateGraph()
End Sub

CreateGraph()
Dim Chart1 As ChChart
Dim Series1 As ChSeries
Dim XValues(1 To 25)
Dim DataValues(1 To 25)

ChartSpace1.Clear

' Add a chart to the ChartSpace
Set Chart1 = ChartSpace1.Charts.Add

' Give it a title
With Chart1
.HasTitle = True
.Title.Caption = Date
End With
For r = 1 To 10
XValues(r) = Cells(r, 1)
Select Case ComboBox1.Value
Case 0
DataValues(r) = Cells(r, 2)
Case 1
DataValues(r) = Cells(r, 3)
Case 3
DataValues(r) = Cells(r, 4)
End Select
Next r

' Create a chart series
Set Series1 = Chart1.SeriesCollection.Add

' Specify chart type and data
With Series1
.Type = chChartTypeLine
.Type = chChartTypeColumnClustered
.SetData chDimCategories, chDataLiteral, XValues
.SetData chDimValues, chDataLiteral, DataValues
End With
End Sub

 
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
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Combobox items determined by the selection in another combobox Alerion Excel Programming 2 September 13th 06 01:07 PM
Combobox options based on the input of another combobox afmullane[_5_] Excel Programming 1 May 3rd 06 01:44 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM


All times are GMT +1. The time now is 12:50 PM.

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"