Search notes:

VBA function: RGB

RGB(r, g, b) creates a long value that represents a color.
Such values might be used, for example, in the Excel Object Model to be assigned to the color attribute.
The value of RGB(r, g, b) is r + 256# * g + 256# * 256# * b.

Calculating the R, G and B components of an RGB value

sub rgb_components(rgb_ as long, byRef r as long, byRef g as long, byRef b as long)

    r = rgb_         mod 256
    g = rgb_ \   256 mod 256
    b = rgb_ \ 65536 mod 256

end sub
Using the function:
sub test_func
    dim r as long
    dim g as long
    dim b as long

    rgb_components rgb(200, 220, 250), r, g, b
    debug.print "r = " & r & ", g = " & g & ", b = " & b
end sub

See also

The VBA runtime defines a limited number constants for some color, for example vbRed, vbGreen or vbBlue.
Color properties in the Excel Object Model.
VBA functions
The R function rgb.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1743434158, '18.223.97.8', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/VBA/functions/RGB(72): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78