ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change pattern for individual data points on chart (https://www.excelbanter.com/excel-programming/421072-change-pattern-individual-data-points-chart.html)

jimt

Change pattern for individual data points on chart
 
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!

jimt

Change pattern for individual data points on chart
 

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*


All times are GMT +1. The time now is 02:08 PM.

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