Change bar color on bar graph

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmorand
    New Member
    • Sep 2007
    • 219

    Change bar color on bar graph

    I'm trying to change the colors for the bars on the bar graph. In the design view I can only change 4 bars, but my graph has 6 bars. How do I go about changing the other bars on the graph?
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Originally posted by dmorand
    I'm trying to change the colors for the bars on the bar graph. In the design view I can only change 4 bars, but my graph has 6 bars. How do I go about changing the other bars on the graph?
    I don't understand why you can't change the other 2 bars. It does not make sense. You need to provide more details. You are welcome to try the following vba code and see if that helps. Replace illustrative objects (YourChartConta inerObject/YourChartObject ) with your actual objects.
    Code:
    Private Sub Form_Open(Cancel As Integer)
    
           With Me.YourChartContainerObject.YourChartObject
               .SeriesCollection(1).Interior.Color = RGB(255, 128, 128) 'peach
               .SeriesCollection(2).Interior.Color = RGB(0, 255, 128) 'green
               .SeriesCollection(3).Interior.Color = RGB(0, 128, 255) 'blue
               .SeriesCollection(4).Interior.Color = RGB(128, 255, 255) 'turquoise
               .SeriesCollection(5).Interior.Color = RGB(255, 255, 128) 'yellow
               .SeriesCollection(0).Interior.Color = RGB(255, 0, 255) 'magenta
           End With
    
    End Sub

    Comment

    Working...