• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 642
  • Last Modified:

How do I get the HEX or RGB numbers for the colours used in Excel Chart Style 2

Hi,

I wish to get the HEX or RBG numbers for the colours that are used in the Excel 2007's chart style 2.

This is the chart style as shown in the sample sheet below.  I have used the macro recorder but that just applies activechart.chartstyle = 2

I am really only interested in the colour of the different data series shown on the example.  Green, Blue, Purple and Red etc.

Thanks
ColourStyle.xlsx
0
wobbled
Asked:
wobbled
  • 2
  • 2
1 Solution
 
Rory ArchibaldCommented:
Do you actually need the individual R, G and B component values, or just the overall RGB number?
0
 
wobbledAuthor Commented:
The overall RBG should be fine

I'm trying to recreate charts in WPF using a similar style to that available in Excel so I can work with any colour codes that Microsoft accepts
0
 
Rory ArchibaldCommented:
OK - for example:
Sub GetRGB()
    Dim n As Long
    With ActiveChart.SeriesCollection
        For n = 1 To .Count
            Debug.Print .Item(n).Border.Color
        Next n
    End With
End Sub

Open in new window


this will output the values to the Immediate Window in the VBE. (you need to select the chart first)
0
 
kgerbChief EngineerCommented:
Whenever I need to get RGB values for something I use Pixie.  It works well.

Kyle
0
 
wobbledAuthor Commented:
Thanks - did the job fine
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now