Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default public array

Hello,

Is it possible to create an array from a range of values, and store it for
use by code in another sheet?

Thanks in advance.


--
AD108


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default public array

Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store it for
use by code in another sheet?

Thanks in advance.


--
AD108




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default public array

Thanks Bob,

Will that work in seperate procedures. For example if I was to load the
array, then the code ends. Then later I access the array from the other
sheet? I think I need to do something like this, as I am working with
template sheets that are always different versions of the original, so I
can't directly reference any said sheet.

Thanks

AD108

"Bob Phillips" wrote in message
...
Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store it

for
use by code in another sheet?

Thanks in advance.


--
AD108






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default public array

That should work okay, as long as it is the same workbook.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Thanks Bob,

Will that work in seperate procedures. For example if I was to load the
array, then the code ends. Then later I access the array from the other
sheet? I think I need to do something like this, as I am working with
template sheets that are always different versions of the original, so I
can't directly reference any said sheet.

Thanks

AD108

"Bob Phillips" wrote in message
...
Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store it

for
use by code in another sheet?

Thanks in advance.


--
AD108








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default public array

Actually it would be different workbooks.
Is there a way to preserve it that way? The source workbook would still be
open.
I could have the code (executed from the destination book) load the array
when the code is running now that I think about it. Do I need to set a
reference between the books? I'm not sure how to do this. Would a
reference become invalid when a book is coppied, as a template is coppied
over and over?

Thanks for your help,


"Bob Phillips" wrote in message
...
That should work okay, as long as it is the same workbook.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Thanks Bob,

Will that work in seperate procedures. For example if I was to load the
array, then the code ends. Then later I access the array from the other
sheet? I think I need to do something like this, as I am working with
template sheets that are always different versions of the original, so I
can't directly reference any said sheet.

Thanks

AD108

"Bob Phillips" wrote in message
...
Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store

it
for
use by code in another sheet?

Thanks in advance.


--
AD108












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default public array

i have an array with 8 elements. i use it in several modules. would it be
possible to store it as a public array so all modules that use it get it from
one place? then i wouldn't have to edit the array in 3 or 4 different modules
when an element changes.

just wondering

--


Gary


"Bob Phillips" wrote in message
...
That should work okay, as long as it is the same workbook.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Thanks Bob,

Will that work in seperate procedures. For example if I was to load the
array, then the code ends. Then later I access the array from the other
sheet? I think I need to do something like this, as I am working with
template sheets that are always different versions of the original, so I
can't directly reference any said sheet.

Thanks

AD108

"Bob Phillips" wrote in message
...
Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store it

for
use by code in another sheet?

Thanks in advance.


--
AD108










  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default public array

ended up just putting the entire array routine in a separate sub and calling it.

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i have an array with 8 elements. i use it in several modules. would it be
possible to store it as a public array so all modules that use it get it from
one place? then i wouldn't have to edit the array in 3 or 4 different modules
when an element changes.

just wondering

--


Gary


"Bob Phillips" wrote in message
...
That should work okay, as long as it is the same workbook.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Thanks Bob,

Will that work in seperate procedures. For example if I was to load the
array, then the code ends. Then later I access the array from the other
sheet? I think I need to do something like this, as I am working with
template sheets that are always different versions of the original, so I
can't directly reference any said sheet.

Thanks

AD108

"Bob Phillips" wrote in message
...
Yes just declare it as a Public variable in a standard code module

Public myArray As Variant

load it as usual

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AD108" wrote in message
...
Hello,

Is it possible to create an array from a range of values, and store it
for
use by code in another sheet?

Thanks in advance.


--
AD108












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
public or global array shishi Excel Programming 2 February 6th 06 09:29 PM
Public Array in a form? lux770[_3_] Excel Programming 4 July 28th 05 08:49 AM
public array Circe[_2_] Excel Programming 6 May 17th 05 11:45 PM
declaring a public array JT[_2_] Excel Programming 3 July 27th 04 11:18 PM
Public Array Brent McIntyre Excel Programming 5 September 23rd 03 12:53 AM


All times are GMT +1. The time now is 04:55 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"