Link to home
Start Free TrialLog in
Avatar of John Carney
John CarneyFlag for United States of America

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
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

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
Avatar of andrewssd3
andrewssd3
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of John Carney

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
If you declare them Public, they will be accessible to all the modules in the VBA project.