Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50167

Setting module-level object variables

$
0
0
Maybe I'm using the wrong term here, but is it possible to set an object variable at the module or global level?

Specifically I simply wish to name a given cell (well, over 100 of them) and then be able to use that name in the module's Sub routines, for example,

Set name1 = Range("a1")

and then

If name1 = true Then
etc, etc

in a Sub procedure.

This works without a problem when I place it inside a Sub, but when I try it up at the beginning of a module, it tells me that it's an "invalid outside procedure".
I figure it'll be helpful if I don't have to declare these over and over again in each Sub procedure.

Thanks in advance
Chris

Viewing all articles
Browse latest Browse all 50167

Trending Articles