98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Charts Formatting
Charts Formatting
Resolved · Low Priority · Version 2003
Peter has attended:
Excel VBA Advanced course
Charts Formatting
when trying to change colors of seriescollections is it possible to dynamically determine the number of sereis collections to avoid trying to change a collection that does not exist?
RE: Charts Formatting
Hi Peter
Thanks for your question
As discussed I will generate the code required to do this and then post it to this thread. I will do this within the next few days
Regards
Stephen
RE: Charts Formatting
Hi Peter
Sorry for the delay in responding
The trick is to use the count method of the seriescollection object. The following code demos this by assigning it to a variable and presenting it in a message box.
Sub ChartsSeries()
On Error Resume Next
Dim aChart As Chart
Dim SeriesCount As Integer
Set aChart = Charts.Add
With aChart
.SetSourceData Sheets(1).Range("A1:D4"), xlColumns
SeriesCount = .SeriesCollection.Count
MsgBox SeriesCount
End With
End Sub
Hope this is useful,please follow up if you have any further questions
Regards
Stephen
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Status Bar FunctionsWhen using the SUM, MIN, MAX, AVERAGE and COUNT functions, the result of such calculations are displayed in the worksheet. |