Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Excel 2010 VBA - Color Ranges for cell backgrounds and fonts

Posted on 2013-11-25
3
347 Views
Last Modified: 2013-11-25
When I use a command:
activecell.font.color = 5300000

my font turns green.

Question:  
1.  How many colors are available in this numbering system (I know it's in the millions)?
2.  Is there a palette of colors that show the approximate value of these numbers?
0
Comment
Question by:brothertruffle880
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
Beneford earned 500 total points
ID: 39674236
These colors are RGB, with 8 bits for each color, so 0-255 giving 16777216 colours in all.

For convenience, we often write them in hexadecimal

5300000 = 0x50df20 - which means 0x50 Blue, 0xDF Green, 0x20 Red.

Just construct the number from the colours you need.

There's a useful list of colors listed here:
http://cloford.com/resources/colours/namedcol.htm (use the column named 'access').
0
 

Author Comment

by:brothertruffle880
ID: 39674616
Are you saying that you can code the color in VBA using hex?

If so, can you give an example?
0
 
LVL 7

Assisted Solution

by:Beneford
Beneford earned 500 total points
ID: 39674656
Prefix the hex number with &H:

    ActiveCell.Font.Color = &HFF207f

will set the colour to Blue=0xFF, Green=0x20, Red=0x7f
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

860 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