Using HTML Colors in Excel

March 26, 2015

Working with colours in excel sometimes might challenge your creativity. Though the colour palette has millions of colours to choose but having those many options is also a problem sometime.

 

When I came across some websites which had a  stunning colour combination, I was wondering why can't my reports have such colour combinations. IThus I would like to share few things which I have been using to make my reports colourful but at the same time keeping them elegant. So that you can use any html color in excel.

 

If you use a little VBA you might know that you can go up to 56 colours using the colour index numbers. If you are not aware,   then copy the below code in a module and run. And you will get the colour index number of each colour.

 

Sub colors()

Dim i As Integer

For i = 1 To 56

    Cells(i, 1).Interior.ColorIndex = i

    Cells(i, 2) = i

Next i

End Sub

 

 

You will get the list of colours that can be used for colouring cells using VBA. If you would want more then you can use the RGB method.

 

Example to colour an activecell using RGB, the code will be:

 

ActiveCell.Interior.Color = RGB(200, 300, 200)

 

The RGB colour model is an  colour model in which red, green, and blue light are added together in various ways to reproduce a broad array of colours. 

 

            

Check the below sample sites for few great colour combinations:

 

http://www.pixelsetaromates.com/

http://fitzfitzpatrick.com/

http://www.tvsafety.org/

 

 

I wanted to use similar colour combinations for my excel reports. So what we can do is identify the HTML  colour (HEX Colour) and convert them to RGB. You can easily identify the html color code from a website or you can choose one from many websites which offer great colour combinations.

 

One of them to try is http://www.computerhope.com/htmcolor.htm

 

Example :

 

#1FDA9A is equivalent to RGB(31,218,154)

#EF6D3B is equivalent to RGB(239,109,59)

 

One way to convert HEX Colour to RGB is to use a formula in Excel - "HEX2DEC".

 

=HEX2DEC("EF") will give 239

=HEX2DEC("6D") will give 109

=HEX2DEC("3B") will give 59

 

Once you have the RGB colour code you can manually change the background in excel. Just select the cell and from the colour palette choose more colours and click on Custom tab. And here input the corresponding red , green and blue number.

 

If you would want to do with VBA then you gotta use it like below:

 

Activecell.interior.color=rgb(239,109,59)

 

I hope this should help you explore further in creating much attractive dashboards in excel.

 

 

(For trainings on excel, excel macros, vba, access or financial modeling- please email us at info@upskilltechnologies.com)

 

 

 

Please reload

Featured Posts

Excel Demo Video

November 14, 2014

1/2
Please reload

Recent Posts

November 14, 2014

Please reload

Search By Tags