Hi All,
I have a macro that determines the average residence times and then charts the nr of particles that lays in a time range (one minute interval) and that has a certain density using a bar chart. In essence I'm showing the residence times that different particles of different densities had during an efficiency test.
The marco works, the graph is drawn as it should. The legend however does not show the correct time formatting. I am using [h]:mm:ss as a time format in my spreadsheet as a standard and would like to have the same format on the chat legend.
This is the code that I used to graph:
Range("BY1").Select
Selection.End(xlToRight).Select
SeriesEnd = ActiveCell.Column
Set xdata = Range(Cells(1, 78), Cells(1, SeriesEnd)) 'x axis data
Range("BY2").Select
Number = Range("AN6")
'Delete old data
ActiveSheet.ChartObjects("ResTimePerDensity").Activate
With ActiveChart
Do Until .SeriesCollection.Count = 0
.SeriesCollection(1).Delete
Loop
End With
'Add data to chart
For n = 1 To Number
If n <= Number Then
RowNr = ActiveCell.Row
Set nDataRange = Range(Cells(RowNr, 78), Cells(RowNr, SeriesEnd))
ActiveSheet.ChartObjects("ResTimePerDensity").Activate
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(n).Name = Cells(RowNr, 77)
ActiveChart.SeriesCollection(n).Values = nDataRange
ActiveChart.SeriesCollection(n).XValues = xdata
ActiveCell.Activate
ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Select
RowNr = ActiveCell.Row
Else
Number = 40
End If
Next n
I have added a copy of the graph and a screenshot of what I see when I select a bar on the chart. It will show that the lable for a bar/data set is typed is.
Is there any way that I will be able to use the [h]:mm:ss time format on the chart legend?
Thank you in advance for your response
TL33
Bookmarks