Excel 2010 Macro Format Sparklines
Most of the available formatting with sparklines involves setting the color of various elements of the sparkline. There are a few methods for assigning colors in Excel 2010. Before going into sparkline properties, read about the two methods of assigning colors in Excel VBA.
Theme Colors
The concept of a theme for a workbook was introduced in Excel 2007. A theme is comprised of a body font, a headline font, a series of effects, and then a series of colors. The first four colors are used for text and backgrounds. The next six colors are the accent colors. The 20 built-in themes include colors that work well together. There are also two colors used for hyperlinks and followed hyperlinks. Focusing on the accent colors, go to Page Layout, Themes, and choose a theme. Next to the theme drop-down is a Colors drop-down. Open the drop-down and select Create New Theme Colors from the bottom of the drop-down.If you want to choose the last color in the first row, the VBA is as follows:
ActiveCell.Font.ThemeColor = xlThemeColorAccent6
Across the top row are the following 10 colors:
xlThemeColorDark1
xlThemeColorLight1
xlThemeColorDark2
xlThemeColorLight2
xlThemeColorAccent1
xlThemeColorAccent2
xlThemeColorAccent3
xlThemeColorAccent4
xlThemeColorAccent5
xlThemeColorAccent6
