Wednesday, January 4, 2017

Excel Convert HEX To RGB

          Hexadecimal(Hex) color codes frequently are used in web designing (HTML-CSS etc.) .

In Excel, the RGB and HLS color codes  are used. Therefore, it is necessary to convert Hex values to RGB or HLS.
          For example,consider we have a hexadecimal code for a cell background color in Excel ; #FF8800 . This code corresponds to orange color.When we convert this code to rgb with userform that we created, the result is RGB(255,136,0). So, we can use the color code as Rgb in Excel and Vba.
For example : "Sheets("Page-1").Range("f11").Interior.Color = RGB(255, 136, 0)
                       TextBox1.BackColor = RGB(255, 136, 0)"

convert hex to rgb