Solved

Excel 2010 VBA - Color Ranges for cell backgrounds and fonts

Posted on 2013-11-25
3
336 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
Comment Utility
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
Comment Utility
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
Comment Utility
Prefix the hex number with &H:

    ActiveCell.Font.Color = &HFF207f

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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

772 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

12 Experts available now in Live!

Get 1:1 Help Now