View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Store variables in code just as you can w. constants? Available to read/edit?

Global?

--
---
HTH

Bob

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



"Leith Ross" wrote in message
ups.com...
On Oct 28, 11:07 pm, tskogstrom wrote:
Hi,
Constants can be set, but is there a way to change them dynamically
when needed, during the work in the workbook? To be used as variables
instead?

I want to store a number of ranges (actually, number of areas) and
have earlier tried to use "cell.value = [range].address" stored in
worksheet cells, but have stranded in that approach and search after
another way.

Best would be if they are accessible from all modules & subs, if
possible.

Kind regards
Tskogstrom


Hello Tskogstrom,

Not sure why you can't use a variable, but that is what you are
describing. A constant's value is fixed during the compilation
process. By definition a constant doesn't change. To make it
accessible to all modules an proceduresn declare the constant or
variable in a Standard VBA Module using the keyword "Public". If you
need this to be seen by Class Modules also, use the "Global" keyword.

Sincerely,
Leith Ross