PDA

View Full Version : Chart in Userform



klaushaas
12-17-2015, 05:12 AM
Hi,

i've just created a chart in an vba userform in excel (shown as a jpeg, saved locally in the background) with the type xlColumnStacked.
there are two series, and four "columns".. so each column is stacked of two values.

So what i want is to have the exact values captioned/labelled/written in each value on the chart.. is that possible??

here is an extract of my chart-code:

....

Dim MyChart As Chart
Dim ChartName As String


ChartName = "Open/Closed"


Set MyChart = Sheets("datenfuerauswahlfelder").Shapes.AddChart(xlColumnStacked).Chart


MyChart.SeriesCollection.Add _
Source:=Worksheets("datenfuerauswahlfelder").Range("p4:s4")


MyChart.SeriesCollection(1).Name = "Priority 2" 'werte von prio 2'

MyChart.SeriesCollection(1).XValues = Sheets("datenfuerauswahlfelder").Range("P2:s2") 'x- achsenbeschriftung'

MyChart.Refresh


MyChart.SeriesCollection.NewSeries

MyChart.SeriesCollection(2).Name = "Priority 1"
MyChart.SeriesCollection(2).Values = Sheets("datenfuerauswahlfelder").Range("P3:S3") 'werte prio1'
MyChart.Refresh
...



thanks

klaushaas
12-17-2015, 05:21 AM
ok i've just found the ".HasLabels" - command (MyChart.SeriesCollection(1).haslabels=true & MyChart.SeriesCollection(2).haslabels=true)