• Charts (Excel 2000)

    Author
    Topic
    #419304

    Hallo
    I want to know if there is a way to change the colour of bars depending on a selection for example Current or Future. I attach a sample for reference.
    Any help would be appreciated.

    Regards

    Kobus

    Viewing 1 reply thread
    Author
    Replies
    • #946288

      You could run this macro:

      Sub ColorChart()
      Dim sht As Worksheet
      Dim cht As Chart
      Dim ser As Series
      Dim i As Integer
      Dim n As Integer
      Set sht = ActiveWorkbook.Worksheets(“Program”)
      n = sht.Range(“H65536”).End(xlUp).Row
      Set cht = ActiveWorkbook.Charts(“Chart1”)
      Set ser = cht.SeriesCollection(2)
      For i = 1 To ser.Points.Count
      Select Case sht.Range(“H” & (i + 1))
      Case “Current”
      ser.Points(i).Interior.Color = vbRed
      Case “Future”
      ser.Points(i).Interior.Color = vbGreen
      End Select
      Next i
      Set ser = Nothing
      Set cht = Nothing
      Set sht = Nothing
      End Sub

      It wil have to be run again if the data in column H change.

    • #946292

      Hans

      Thanks again to the genius.

      Regards

      Kobus

      • #946295

        Here is a non-macro method (needs 2 new data columns)

        Steve

        • #946325

          Steve

          Thank you also, it always amazes me how easy it seems when you guys give a solution

          • #946328

            The non-macro solution can be expanded to other “types” (just add more columns) and is also “live” and will change as the type changes, automatically.

            You can even add the legends for all the different types…

            Steve

    Viewing 1 reply thread
    Reply To: Charts (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: