Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

charts formatting

ResolvedVersion 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 courses

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Shared Conditional Formatting

In a shared workbook, conditional formats applied before the workbook was shared will continue to work; however you cannot modify the existing conditional formats or apply new ones.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.