JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
Apparently VB has an RGB function, but VBA does not. At least, when I try this in the Immediate wiondow,
I get "Compile error. Expected: line number or label or statement or end of statement". I don't understand that error, so I thought I'd write my own:
I put it in my person add-in module, but when I run it from a worksheet, it gets a Value error.
How can I either get a built-in RGB function or the one above to work?
Thanks
Code:
=rgb(255,0,0)
Code:
Function RGB(R As Long, G As Long, B As Long) As Long
RGB = R + 256 * (G + (B * 256))
End Function
How can I either get a built-in RGB function or the one above to work?
Thanks