Results 1 to 2 of 2

Set the stacked bar chart colors to automatic in Excel

Threaded View

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Bristol
    MS-Off Ver
    Excel 2010
    Posts
    1

    Set the stacked bar chart colors to automatic in Excel

    I have a macro that sets all the series on a stacked bar chart to have the same color, as well as a couple other bits like this:

    Sub RefreshLabels()
    
    ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh Dim ch As Chart ActiveSheet.ChartObjects("ProjectChart").Activate Set ch = ActiveChart ch.SetElement (msoElementDataLabelCenter) Dim sc As SeriesCollection Set sc = ch.SeriesCollection Dim showLabel As Boolean If (Range("showLabels").Value = "Y") Then
    showLabel = True
    Else
    showLabel = False
    End If Dim sameColor As Boolean If (Range("sameColor").Value = "Y") Then
    sameColor = True
    Else
    sameColor = False
    End If Dim s As Series For Each s In sc If (sameColor = True) Then
    s.Border.Color = RGB(Range("rgb_r"), Range("rgb_g"), Range("rgb_b")) s.Interior.Color = RGB(Range("rgb_r"), Range("rgb_g"), Range("rgb_b"))
    Else
    'CODE HERE TO MAKE COLORS AUTOMATICALLY SELECTED FROM PALLETTE
    End If Set dl = s.DataLabels dl.ShowSeriesName = showLabel dl.ShowValue = False Next
    End Sub
    However I need the option to change the series back to how the default stacked bar chart was, with the colors selected automatically to a palette of sorts.

    Let me know if you need any further information.
    Last edited by Cutter; 09-04-2012 at 11:19 AM. Reason: Replaced INDENT tags with CODE tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1