Solved

Excel 2010 VBA - Color Ranges for cell backgrounds and fonts

Posted on 2013-11-25
3
349 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
[X]
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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

730 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