One of the most useful things you can do with VBA is format cells in a range. The Range9 sub illustrates how to apply various formats to a range. Note in particular the Color property of the Font or Interior of a range. This property can be specified as one of the eight VBA constants (vbBlack, vbBlue, vbCyan, vbGreen, vbMagenta, vbRed, vbWhite, and vb Yellow), or as any of more than 16 million combinations of red-green-blue (RGB) values. For example, red is equivalent to RGB(255,0,0), so instead of the line .Color = vbRed, you could use the line .Color = RGB(255,0,0). Each RGB argument is an integer from 0 to 255 and indicates the amount of red, blue, and green in the color. You can also specify “theme” colors by their Theme Color and Tint And Shade properties, as has been done toward the bottom of the sub. In fact, these two properties are set if you color a font or interior with the recorder on. (Themes were introduced in Excel 2007.)
To understand these better, look at a color palette in Excel 2007 or a later version. In the Theme Colors section, each column corresponds to a Theme Color value, such as xlThemeColorAccent2, and each Tint And Shade value is a percentage for the lightness or darkness of this color. If you specify theme colors and then change the theme (from Excel’s Page Layout ribbon), the colors in the worksheet will change automatically to those in the new theme. I found the Theme Color and Tint And Shade values from recording. This is the best way to find them. This whole topic of colors in Excel and VBA is rather complex, so I created the file Colors in Excel.xlsm to help you out. Note that Microsoft changed the theme colors in Excel 2013 for reasons we can only surmise. If you prefer those in Excel 2007 and 2010, you can specify the “Excel 2007–2010” theme in the Colors dropdown of the Page Layout ribbon
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more