How to give numbers to the font colors

I

Igneshwara reddy

Hi,

I have some data in A column. for Ex:
Column "A"
ABC - this is in red color font - For red color 1
DEF - this is in black color font - for Black color 2
GHI - this is in green color font - for Green color 3
JKL - this is in yellow color font - for Yellow color 4

Based on the color of the fonts I need to assign numbers like 1,2,3,4,.

Please let me know how can i proceed.

Thanks and regards,
Igneshwara reddy
 
G

Gary''s Student

If A1 contains colored values, then
=fontcolor(A1) will return the number of the font. The UDF is:

Function fontcolor(r As Range)
fontcolor = r.Font.ColorIndex
End Function
 
G

Gord Dibben

The font colors already have a number which you cannot change so you might as
well use them.

Here is a partial list............

1 Black
2 White
3 Red
4 Bright Green
5 Blue
6 Yellow
7 Pink
8 Turquoise
9 Dark Red
10 Green
11 Dark Blue
12 Dark Yellow
13 Violet
14 Teal
15 Gray-25%
16 Gray-50%

See the Student's posting for a UDF to check the font colors you have.

For more on colors in Excel see David McRitchie's site.

http://www.mvps.org/dmcritchie/excel/colors.htm


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top