ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatically retrieving constants (https://www.excelbanter.com/excel-programming/413700-programmatically-retrieving-constants.html)

Matthew Norman

Programmatically retrieving constants
 
Hi,

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

the allowed constants a
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???


Peter T

Programmatically retrieving constants
 
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

"Matthew Norman" wrote in message
...
Hi,

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

the allowed constants a
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???





All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com