Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Interactive Chart To Excel VB Form

Status
Not open for further replies.

mutuelinvestor

Programmer
Joined
Jun 22, 2009
Messages
14
Location
US
I've been googling all morning without any success so I thought I try this forum. I'm trying to add a chart to an excel vb userform. I'd like to have the chart linked to data in a related worksheet so that when the data in the worksheet changed the chart would change too. I've been trying to work with the MS ChartSpace office component, but haven't had any luck.

If anyone has any experience with this, I'd love to hear from you.

Thanks,
Jim
 



Hi,

What have you tried so far?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Skip,

I've tried manipulating the ChartSpace component via VB, but had no luck, I've tried trying to make my worksheet a data source and I've been doing a lot of searching on the Internet.

Thanks,
Jim
 



You might check thread707-1530759.

I have never had the need to embed a chart in a userform. However, I often use events in Excel charts and use Form Controls with these charts as well, since Control Toolbox controls cannot be inserted into a chart.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Is it possible to use something like this in a form:


Sub ChartFromArrays()
Dim myChart As Chart
Set myChart = ActiveSheet.ChartObjects.Add(100, 100, 325, 250).Chart
With myChart
.SeriesCollection.NewSeries
.ChartType = xlXYScatterLines
With .SeriesCollection(1)
.Name = "The Series"
.values = Array(1, 3, 5, 7, 9)
.XValues = Array(1.5, 2.5, 3.5, 4.5, 5.5)
End With
End With
End Sub
 



That's in a SHEET; not in a UserForm.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Yes, I saw that I was hopeful that it would be possible to use something like Set myChart =UserForm4.ChartObjects.Add(...)

No such luck. Back to the drawing board.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top