Excel Cell Font Color Programatically
I have a spreadsheet with some cells black and some red. Im trying to programatically tell the difference in a macro, but cells(x,y).Font.Color is equal to 0 for all cells whether red or black. Is there another prop to look at?
Thanks in advance for any help!
Re: Excel Cell Font Color Programatically
Cells(x,y).Font.Color returns 255 for red for me, and 0 for black.
When you deal with the Color property, it returns an RGB color code that you can split apart using a method found on Chip Pearson's site. Check it out, it's a good read (the one I'm talking about is 3/4 toward the bottom under "RGB Colors").
You can also use Font.ColorIndex which returns a number from the color palette.
HTH
Re: Excel Cell Font Color Programatically
:wave: :wave: :wave: :wave: :wave: How about changing the back color ? and aligning the text. THANKS
Re: Excel Cell Font Color Programatically
Quote:
Originally Posted by Muddy
I have a spreadsheet with some cells black and some red. Im trying to programatically tell the difference in a macro, but cells(x,y).Font.Color is equal to 0 for all cells whether red or black. Is there another prop to look at?
Thanks in advance for any help!
When you say "some cells black and some red" do you mean the background color of the cells and not the foreground color?
Use .Color or .ColorIndex for foreground (or text) color
Use .Interior.Color or .Interior.ColorIndex for background color.