Link to home
Start Free TrialLog in
Avatar of brothertruffle880
brothertruffle880Flag for United States of America

asked on

Excel 2013 VBA - How to use hex digits to color the interior of a cell.

How can I use hex digits to color the interior of a cell.
I'm trying to use this chart
http://dmcritchie.mvps.org/excel/colors.htm

using this syntax
Range("c1:c20").Interior.Color = &H222222

but I'm doing something wrong!
Help!
Avatar of Koen
Koen
Flag of Belgium image

and what are you doing wrong?
your code turns cells C1 to C2 in black... (at least in my excel)... Is that not what you want?
'&H222222' isn't a Hex colour code. What colour are you after?
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You do not "need" to convert that value. The function only makes it more user-friendly to use HEX colour values. If you record a macro and change the colour you will see that it will work just fine with integer colour value.
Avatar of brothertruffle880

ASKER

Thanks everyone!  Great insights on using that option.
I feel like I took a college class in color.
You are welcome!