2

I have a bunch of code in excel macro which includes following pattern ;

Sheet1.Cells(i, 1).Interior.ColorIndex = 4
Sheet1.Cells(j, 1).Interior.ColorIndex = 4

As you see, I'm painting some cells with color value 4 in my code. But there are only 56 colors in color palette that I can use. I would like to transform the code in order to use RGB (R, G, B) format which will let me use more than 56 colors.

Does somebody know how to transform my code properly? Thanks...

1 Answer 1

2

To use RGB you simply use

Sheet1.Cells(i, 1).Interior.Color = RGB(0,255,0)

You can then review this site, which shows you the color index, the HEX and the RGB equivalent of each

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

So, in the example above this is the same as Color.Index 4 (green)

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .