Embedded Charts in a Chart Object Container

The ChartObject object represents the "container" for an embedded chart. The purpose of having this container is to enable you to specify its size (height, width) and location (top, left) on the worksheet. These properties apply to all objects (such as pictures or autoshapes) that can be embedded on a chart.

To illustrate, go to any worksheet with an embedded chart. With the Ctrl or Shift key depressed, click the chart. The eight resize handles appear white as shown in Figure 10.1. You have now selected the chart object. The Name box to the left of the formula bar shows Chart 1 (or whatever the name of the chart is). You can rename the embedded chart object by entering another name, say MyChart, in the Name box. Subsequently, you can use this name in your VBA code to refer to the embedded chart object. For example:

ActiveSheet.ChartObjects("Chart 1").Select

Figure 10.1

By holding down the Ctrl key or the Shift key before clicking the chart, you get the white resize handles indicating that the ChartObject container has been selected.This is the easiest way to learn that this ChartObject is named "Chart 1" (see Name box).

Ö Microsoft Excel - CharLsaVBA.xls

1:9] Be

Edit

View Insert Fernet

lock

Eats SündoJ

: J J A _j J U

0 0

Post a comment