Code to format data series?

S

Snowsride

I have three line graphs, DervGraph, UlgGraph and SulgGraph, that display
prices by oil company brand e.g. B.P, Asda, Esso, Total etc. One graph shows
diesel prices, one shows unleaded prices and the third super unleaded
however, not all charts will have the same number of brands displayed e.g.
the diesel graph may have seven brands, the unleaded eight and the super only
six.

I want each brand to be coloured the same in each chart e.g. B.P. always to
be green, Esso always to be black regardless of how many data series there
are. I have some code that does the trick in Excel but I don't know how to
adapt it for Access - see sample below :-

Dim iSrsCt As Integer, iSrsIx As Integer
Dim minRange As Range

iSrsCt = ActiveChart.SeriesCollection.Count

For iSrsIx = 1 To iSrsCt

Select Case ActiveChart.SeriesCollection(iSrsIx).Name

Case "ASD"
ActiveChart.SeriesCollection(iSrsIx).Select
With Selection.Border
..ColorIndex = 54
..Weight = xlMedium
..LineStyle = xlContinuous
End With

Case "BP"
ActiveChart.SeriesCollection(iSrsIx).Select
With Selection.Border
..ColorIndex = 43
..Weight = xlMedium
..LineStyle = xlContinuous
End With

Case "ESS"
ActiveChart.SeriesCollection(iSrsIx).Select
With Selection.Border
..ColorIndex = 3
..Weight = xlMedium
..LineStyle = xlContinuous
End With

End Select

Next


Grateful for any help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top