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:
Any hints/tips appreciated!
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