Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Store variables in code just as you can w. constants? Available to read/edit?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Store variables in code just as you can w. constants? Available to read/edit?
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Store variables in code just as you can w. constants? Available to read/edit?
Just use public variables declared at the start of a standard code module.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "tskogstrom" wrote in message ups.com... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Store values in variables based on count | Excel Programming | |||
How to store variables of a single cell in a column? | Excel Programming | |||
conversion of variables to constants | Excel Worksheet Functions | |||
Store variables between XLA sessions | Excel Programming | |||
read the values in a range and store them in macro | Excel Programming |