Somebody from the forum help me with the below code which worked great for colouring a bars on a bar chart. I now wanted to use the code and apply to another chart within the same workbook. But I cannot figure out what part of the code is refering to the actual chart?

Can anyone help point this out to me?


Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)

    Dim PTChart As Chart
    Dim PointIndex As Long
    
    Set PTChart = Target.Parent.ChartObjects(1).Chart
    With PTChart.SeriesCollection(1)
        For PointIndex = 1 To .Points.Count
            Select Case Application.WorksheetFunction.Index(.Values, 1, PointIndex)
            Case Is < 5
                .Points(PointIndex).Format.Fill.ForeColor.RGB = vbRed
            Case 5 To 10
                .Points(PointIndex).Format.Fill.ForeColor.RGB = vbYellow
            Case Else
                .Points(PointIndex).Format.Fill.ForeColor.RGB = vbGreen
            End Select
        Next
    End With
End Sub