John Carney
asked on
Identifying a color by name in VBA
Instead of:
cel.Interior.Color = RGB(102, 0, 204)
I want to say:
cel.Interior.Color = Purple
How do I write that?
Thanks,
John
cel.Interior.Color = RGB(102, 0, 204)
I want to say:
cel.Interior.Color = Purple
How do I write that?
Thanks,
John
You can't. There is a limited set of VBA named colors and they are vbBlack, vbBlue, vbCyan, vbGreen, vbMagenta, vbRed, vbWhite and vbYellow.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks! BTW, I know I can create a public declaration of variables accessible in all subs in a given module, but is there a way to define all the color variables in one module such that they will be accessible by all other modules?
- John
- John
If you declare them Public, they will be accessible to all the modules in the VBA project.