O'Reilly logo

Excel® 2007 Charts by John Walkenbach

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 16. Working with Colors

In This Chapter

  • Specifying colors in VBA code

  • VBA conversion functions for various color models

  • Converting colors to grayscale

  • Working with Excel 2007 document themes

  • Modifying colors in Shape objects and charts

One of the most significant changes in Excel 2007 is the abandonment of the old 56–color workbook palette. This chapter describes how color is used in Excel 2007, including the new "themes." I include many examples that should help you understand how these changes affect your workbooks and charts. The chapter also contains VBA code that deals with colors.

About Excel 2007 Colors

Dealing with color in Excel 2007 is no trivial matter. I'm the first to admit that it can be complicated. And often, recording a macro while you change the color of a cell or object only adds to the confusion. In this chapter, I attempt to pull it all together.

Back in the pre–Excel 2007 days, a workbook stored a palette of 56 colors. These colors were the only ones available for cell backgrounds, cell text, and charts. Sure, you could modify any or all of those colors, but you couldn't exceed the 56–color limit for a workbook.

But things have changed. You now have access to a virtually unlimited number of colors in a workbook — actually, the limit is 16, 777, 216 colors, but that certainly qualifies as "virtually" unlimited as far as I'm concerned.

Specifying Colors

Using VBA, you specify a color as a numeric color value, which is a number between 0 and 16, 777, 215. For example, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required