Chapter 16: Working with Charts
In This Chapter
• Discovering essential background information on Excel charts
• Knowing the difference between embedded charts and chart sheets
• Understanding the Chart object model
• Using methods other than the macro recorder to help you learn about Chart objects
• Exploring examples of common charting tasks that use VBA
• Navigating more complex charting macros
• Finding out some interesting (and useful) chart-making tricks
• Working with Sparkline charts
Getting the Inside Scoop on Charts
Excel's charting feature lets you create a wide variety of charts using data that's stored in a worksheet. You have a great deal of control over nearly every aspect of each chart.
An Excel chart is simply packed with objects, each of which has its own properties and methods. Because of this, manipulating charts with Visual Basic for Applications (VBA) can be a bit of a challenge. In this chapter, I discuss the key concepts that you need to understand to write VBA code that generates or manipulates charts. The secret, as you'll see, is a good understanding of the object hierarchy for charts.
Chart locations
In Excel, a chart can be located in either of two places in a workbook:
• As an embedded object on a worksheet: A worksheet can contain any number of embedded charts.
• In a separate chart sheet: A chart sheet normally holds a single chart.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
Compatibility ...