No attribution, so I assume it’s David Hagar
EXCEL 2000 TIP
An intriguing property was added to the Range object in Excel 2000. It
is the ID property. In the normal scheme of things, it assigns a string
to a worksheet cell, which is used in a HTML tag when the worksheet is
saved as a web page. If the worksheet is saved in a normal manner, the
ID does not appear to be persistent. However, if ID’s of cells are set
when a workbook is opened, they can be used in some interesting ways.
As an example, consider the following:
.Range(“a1”).ID = “Test”
‘in Sheet1 module
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Address <> Target.Address Then Exit Sub
If Target.ID <> “” Then
In this case, if A1 is selected, the MsgBox dialog will appear with
the text “Test”. Thus, this provides a method of creating cell comments
that do not have to be stored with the cells. Further, if the assignment
of ID strings to cells is criteria-based rather than address-based, then
this provides a dynamic method of documenting cells of varying properties.
Another use of the ID property would be to apply the Collection class
for the Tag property developed by Ken Getz and Mike Gilbert (shown in the
Nov ’98 issue of MOD magazine, p.36) to this system. I leave that as an
exercise to the reader.
Editor’s Note: It’s too bad this property doesn’t persist. Maybe when Excel goes XML, it will.