Programmatically retrieving constants

M

Matthew Norman

Hi,

I want to loop through all the series on my chart and change the line
style to possibilities...

the allowed constants are:
XlContinuous
XlDash
xlDashDot
xlDot
etc

xlContinuous has a value of 1, xlDash has a value of -4115 etc...

Is there any way of looping through the allowed values, and therefore
assigning the "next" constant to the dataseries being processed???
 
P

Peter T

Sub test()
Dim i As Long
Dim nStyle As Long
Dim cht As Chart
Dim sr As Series
Dim arr

arr = Array(xlContinuous, xlDash, xlDot, xlDashDot, xlDashDotDot, _
xlGray25, xlGray50, xlGray75)

Set cht = ActiveSheet.ChartObjects(1).Chart

nStyle = LBound(arr)
For i = 1 To cht.SeriesCollection.Count
Set sr = cht.SeriesCollection(i)

sr.Border.LineStyle = arr(nStyle)

If nStyle >= UBound(arr) Then
nStyle = LBound(arr)
Else: nStyle = nStyle + 1
End If
Next

End Sub


Not sure about those Grays though

Regards,
Peter T
 

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