Working with Colors in a Macro

by Allen Wyatt
(last updated December 21, 2018)

1

Jerri is trying to reference rather simple colors in a macro. In older versions of Excel the color references were understandable, but she's having problems with colors since the introduction of themes. If she records a macro, she gets references to various properties, such as Pattern, PatternColorIndex, TintAndShade, PatternTintAndShade, and ThemeColor. Jerri can't make sense of these and wonders if there is a good reference available that provides the background information she needs to work with colors in a macro.

You aren't alone, Jerri. The new color schemes introduced in Excel 2007 seem to baffle many people. The simple approach to colors used in older versions of Excel is gone, and the new approach doesn't seem to have any humanly discernable rhyme or reason. Doing simple searches at Microsoft doesn't turn up any helpful information. For instance, a search of Microsoft online support for PatternTintAndShade (which should get right to the heart of the matter) returns nothing—and this is three years after Excel 2007 was released! A wider search for the same word, looking at all of Microsoft.com, returns something only marginally more useful; it returns a page that describes the PatternTintAndShade property as a property that "returns or sets a tint and shade pattern." The reaction that comes to mind is "well, duh!"

In searching around the web there are lots of questions that crop up very similar to yours and precious few answers. There was one site that has a bit of useful information and is well worth reading:

http://www.databison.com/index.php/excel-color-palette-and-color-index-change-using-vba/

Sorry about the long URL; you'll want to make sure you get it all. Perhaps, as time goes on, more information will come available.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7883) applies to Microsoft Excel 2007.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Changing Strikethrough Lines

Want to change the way a strikethrough line appears? It's not as easy as you think, as you find out in this tip.

Discover More

Speeding Up Mail Merges

The Mail Merge tool in Word is a great way to create new, customized documents. If you are doing a lot of merging, you ...

Discover More

Discovering Printer Drift

How accurate is your printer when it comes to placing information on the printed page? The simple technique described in ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Displaying the Selected Cell's Address

Need to know the address of the cell that is currently selected? The function and macro highlighted in this tip will come ...

Discover More

Magnifying Only the Current Cell

You can use the Zoom feature of Excel to magnify what Excel shows of your workbook, but it affects the entire screen. ...

Discover More

Copying Named Ranges

Named ranges are a great tool to use in developing formula-heavy workbooks. You may want, at some point, to copy your ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 9?

2019-04-22 06:18:34

Ron S

"October 2018 release of Windows 10" MS marketing obfuscation. In addition to that ID it would be more directly relevant if you included the identification "Windows 10 Version 1809", because that is what we see in WinVer. And it is easier to relate to later WinVer numbers like 1903 ...


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.