Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Store values in variables based on count Microsmith Excel Programming 3 May 20th 07 02:44 PM
How to store variables of a single cell in a column? noyau Excel Programming 5 December 25th 06 01:21 PM
conversion of variables to constants beecher Excel Worksheet Functions 5 November 26th 06 03:55 AM
Store variables between XLA sessions Timo Autiokari Excel Programming 2 January 16th 04 12:02 PM
read the values in a range and store them in macro Tom Ogilvy Excel Programming 0 September 13th 03 11:05 PM


All times are GMT +1. The time now is 03:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"