I am converting R, G, B colors to a Long variable.
I believe that this is the correct way to do it:
Dim lngColor As Long
lngColor = B * 65536 + G * 256 + R
R, G, and B have been defined as Bytes and their value are R=189, G=197, B=197
I get an overflow error on
G * 256
but I do not get an error on B * 65536
For example:
Dim C1 As Long
Dim C2 As Long
Dim C3 As Long
C3 = B * 65536 <---------- No error
C2 = G * 256 <---------- Overflow
C1 = R


Reply With Quote
