![]() If not, you can use any RGB to Hex converter ( such as this one) to find the Hex code of a color.Īs you noticed, a hex color code contains 6 characters. In recent Excel versions the Hex code of the color is also presented. ![]() You can use Excel to choose a color you like from the color selection dialog box to see its RGB values. VBA offers an RGB function to convert a mix of RGB values to the decimal code of a color, making it useful to assign an RGB mix to any Color property. Our cyan color above has a mix of 68 red, 247 green and 255 blue. Each component takes a value between 1 and 255. Range("A1").Interior.Color = xlNone The RGB representation of a colorĪnother way to represent a color is by its unique combination of the Red, Green and Blue components, or RGB in short. Luckily, we have an Excel enumeration for that, so you do not need to remember the specific code, just assign xlNone like that: Tip: to clear the background (Fill) color of a range, assign it the value -4142. For example, the background color of cell A1 can be set to be cyan in one of the following two options: Precede the Hex value with the &H prefix (our cyan code will be set to: &HFFF744). You can assign the color codes to any Color property of any object in either their decimal or hex representation. For example, that cyan color number equals FFF744 in Hex representation (use any decimal to hex converter you find on the web to see how it works). You can also convert any decimal number to its Hexadecimal representation (or Hex for short). Every color is identified by a unique number.
0 Comments
Leave a Reply. |