charts formatting

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

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Charts Formatting

Charts Formatting

resolvedResolved · 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 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:

Status Bar Functions

When using the SUM, MIN, MAX, AVERAGE and COUNT functions, the result of such calculations are displayed in the worksheet.

However, if a range of cells, containing numbers, is highlighted, and then a right-mouse click is performed at the bottom right side of the status bar, then the result of those functions will be displayed.

View all Excel hints and tips


Server loaded in 0.08 secs.