Microsoft Office Tutorials and References
In Depth Information
The following example demonstrates. It displays the address of the values range
for the first series in the active chart.
Dim Ser As Series
Dim x As Variant
Set Ser = ActiveChart.SeriesCollection(1)
x = VALUES_FROM_SERIES(Ser)
If x(1) = “Range” Then
The variable x is defined as a variant and will hold the two-element array that’s
returned by the VALUES_FROM_SERIES function. The first element of the x array
contains a string that describes the data type. It the string is Range , then the message
box displays the address of the range contained in the second element of the x array.
The VBA code for these functions is too complex to be presented here, but
it’s available on the companion CD-ROM. It’s documented such that it can
be easily adapted to other situations.
You’re probably familiar with the ability to protect a worksheet using the Tools
Protect Sheet command. When a worksheet is protected, “locked” cells
cannot be changed. By default, all cells are locked. They can be unlocked by using
the Protection tab of the Format Cells dialog box. Protecting a sheet also disables
modification of any embedded charts on the worksheet.
You may have also discovered that you can protect a Chart sheet — also by using
Protect Sheet command. When a Chart sheet is protected,
the chart cannot be modified.
Beginning with Excel 2002, sheet protection has become more versatile.
When you protect a sheet, you are presented with a list of options that can
be performed when the sheet is protected. Among those options is Edit
Objects. When this option is enabled, charts can still be edited when the
sheet is protected.