Solved

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

Posted on 2012-03-26
5
578 Views
Last Modified: 2012-06-27
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
Comment
Question by:wobbled
  • 2
  • 2
5 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 37766619
Do you actually need the individual R, G and B component values, or just the overall RGB number?
0
 
LVL 17

Author Comment

by:wobbled
ID: 37766672
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
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 37766723
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
 
LVL 12

Expert Comment

by:kgerb
ID: 37766729
Whenever I need to get RGB values for something I use Pixie.  It works well.

Kyle
0
 
LVL 17

Author Closing Comment

by:wobbled
ID: 37766767
Thanks - did the job fine
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now