How to select every other data point in a series to format transparency

Joined
Apr 25, 2012
Messages
1
Reaction score
0
Hi,
I have been puzzelled by this for a long time and cannot find the answer anywhere. I have the code below which loops through all the series I have in a chart and tries to format every other point with a transparency of 0.6. It works in that it cycles each series and every other point in the series, but it formats the whole series as transparent rather than each point once at a time...

My code is below and hope it makes sense.
Please Help!
Thank you.

Function HighlightActual1()
Dim mySrs As Series 'series working on'
Dim nPts As Integer 'number of points in the series'
Dim nSrs As Integer 'number of series in the chart'
Dim i As Integer 'loop integer'
Dim p As Integer 'loop integer'
Dim j As Long 'even number'
Dim MyChart As Chart 'chart'

ActiveSheet.ChartObjects("Chart 2").Activate
Set MyChart = ActiveChart
With MyChart
nSrs = ActiveChart.SeriesCollection.Count
For p = 1 To nSrs
Set mySrs = ActiveChart.SeriesCollection(p)
With mySrs
nPts = .Points.Count
For i = 1 To (nPts / 2)
j = (2 * i) 'j as even integer'
.Points (j)
.Format.Fill.Solid
.Format.Fill.Transparency = 0.6
Next i
End With
Next p
End
End With
End Function
 

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