Adding custom property to Range object

M

Morgan

Hi all,

We have a need to attach some information to some cells in a worksheet
programmatically. We do not want user to see or be able to change/remove
attached information. We are currently using ID property, but it has some
draw backs, e.g. not persisted when saving the Excel file, can be moidfied
when data validation is used. I am wondering whether there is a way to add
custom property to the Range object so we can use that to store the
information.

Thanks in advance,

Morgan Cheng
 
B

Bob Phillips

You could add a worksheet name like so

rng.Parent.Names.Add _
Name:=rng.Parent.Name & "!Add_" & rng.Address(False, False), _
RefersTo:="myCustomProp"

and read it like so

MsgBox Evaluate(rng.Parent.Names(rng.Parent.Name & "!Add_" &
rng.Address(False, False)) _
.RefersTo)


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top