PDA

View Full Version : Solved: User defined name (not linked to cell)



Johnlemons
07-19-2005, 09:27 AM
Anybody know how to access a user name from a sub routine
that is not linked to a cell in a sheet? :mkay

If Work=Range("a2") you could in a sub use
Range("Work")=Range("Work")+1

But if you had Work=15 (not assigned to a cell)
the above doesn't work. Anybody know how to make this work?

Thanks,
John.

Bob Phillips
07-19-2005, 10:06 AM
Anybody know how to access a user name from a sub routine
that is not linked to a cell in a sheet? :mkay

If Work=Range("a2") you could in a sub use
Range("Work")=Range("Work")+1

But if you had Work=15 (not assigned to a cell)
the above doesn't work. Anybody know how to make this work?

Are you surprised you can't use Range on a non-range name? :)

activeworkbook.Names("Work").RefersTo

gets the refersto value, but this includes the =. To get the underlying value, use

evaluate(activeworkbook.Names("Work").RefersTo)
.

Johnlemons
07-19-2005, 10:53 AM
Solved:
Truly amazing. I never would have gotten that.
Thanks alot,
John.