largeselection
Active Member
- Joined
- Aug 4, 2008
- Messages
- 358
As you may already know...I've gotten to the point where I have established 12 different ranges based on cells values.
All of the cells in the ranges are in column B.
So my ranges look something like this after the code (lets call it routineA) has run:
Rng1 = B2, B5, B9, B50, B60
Rng2 = B1, B3, B6, B8
Rng3 = B4, B20, B31
etc
etc
etc
Is it possible to refer to these ranges in a different sub-routine without having to define them again?
IE- So I run routineA and get all these nice, organized ranges. Now I want to run another routine which says "sum all the values for the cells within Rng1, then do it for Rng2, then Rng3, etc."
As it stands now if I try to do something like that it doesn't work and I'm assuming that's because they are separate routines. So even if I run routineA, if I try and run a different one that says sum(rng1) it doesn't know what is in rng1 because I haven't defined it in routineB.
Is it possible to refer to ranges established in a different sub? If so, how?
Any links/insight/books you can point me to would be much appreciated.
All of the cells in the ranges are in column B.
So my ranges look something like this after the code (lets call it routineA) has run:
Rng1 = B2, B5, B9, B50, B60
Rng2 = B1, B3, B6, B8
Rng3 = B4, B20, B31
etc
etc
etc
Is it possible to refer to these ranges in a different sub-routine without having to define them again?
IE- So I run routineA and get all these nice, organized ranges. Now I want to run another routine which says "sum all the values for the cells within Rng1, then do it for Rng2, then Rng3, etc."
As it stands now if I try to do something like that it doesn't work and I'm assuming that's because they are separate routines. So even if I run routineA, if I try and run a different one that says sum(rng1) it doesn't know what is in rng1 because I haven't defined it in routineB.
Is it possible to refer to ranges established in a different sub? If so, how?
Any links/insight/books you can point me to would be much appreciated.