Change pattern for individual data points on chart

J

JimT

Using a standard column chart, I would like to change the pattern for a given
data point if it's reference cell contains the text "Fail".

The code I've got thus far will change the first point that Fails the first
time the macro is run. It won't change other points that Fail, and if I
change the pattern manually and run the code again, it will only select the
first data point that Fails, but not change the pattern.

Code follows:
Code:
Private Sub Stripe()

Dim objCht As ChartObject
Dim i As Integer
Dim rngCnt As Range
Dim rngCell As Range

With Sheets(1)
Set rngCnt = .Range(.Range("E2"), .Range("E65536").End(xlUp))

i = 1

For Each rngCell In rngCnt
If rngCell.Offset(, 1) = "Fail" Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Points(i).Select
Selection.Fill.Patterned Pattern:=msoPatternWideUpwardDiagonal
End If
i = i + 1
Next rngCell
End With
End Sub
Any hints/tips appreciated!
 
J

JimT

Okay, so I'm silly. Well actually my Citrix client is silly. The below code
DOES work as expected; just I had a hanging Excel instance that was munging
up the works.

Thanks, all. Now on to the next issue... *laughter*
 

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