Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Array Declarations
Hello All
Just a quickie. I have two Userforms that use exactly the same information in a combobox (different names) if I wanted to only declare the Array once where would I put it? Both Userforms have the Array declared on the Userform_Initialize() event so if one of the Userforms wasn't loaded (highly likely) where and how should I declare? Many thanks for any help Mark (InWales) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Array Declarations
Mark,
You can declare it as a Public variable in a regular code module. Then, ReDim it, if necessary, in the form's code module. '[in Module 1] Public Arr() As String '[in Form module] Public Sub Userform_Initialize() ReDim Arr(1 to whatever) End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Mark (InWales)" wrote in message ... Hello All Just a quickie. I have two Userforms that use exactly the same information in a combobox (different names) if I wanted to only declare the Array once where would I put it? Both Userforms have the Array declared on the Userform_Initialize() event so if one of the Userforms wasn't loaded (highly likely) where and how should I declare? Many thanks for any help Mark (InWales) |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Array Declarations
You should declare it as a global variable in a general module. Then
initialize it there as well. Then either/both userforms can see it. -- Regards, Tom Ogilvy "Mark (InWales)" wrote in message ... Hello All Just a quickie. I have two Userforms that use exactly the same information in a combobox (different names) if I wanted to only declare the Array once where would I put it? Both Userforms have the Array declared on the Userform_Initialize() event so if one of the Userforms wasn't loaded (highly likely) where and how should I declare? Many thanks for any help Mark (InWales) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Array Declarations
Hi, insert a module and rename it to 'Main'. At the top declare the
array as a global--"Public myArray As Varriant". Insert a Procedure within 'Main' and write the code to populate your array and then call that procedure from your form initialization code. HTH--Lonnie M. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help with Array Declarations
Many thanks both.
Mark "Tom Ogilvy" wrote in message ... You should declare it as a global variable in a general module. Then initialize it there as well. Then either/both userforms can see it. -- Regards, Tom Ogilvy "Mark (InWales)" wrote in message ... Hello All Just a quickie. I have two Userforms that use exactly the same information in a combobox (different names) if I wanted to only declare the Array once where would I put it? Both Userforms have the Array declared on the Userform_Initialize() event so if one of the Userforms wasn't loaded (highly likely) where and how should I declare? Many thanks for any help Mark (InWales) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prevent cell/array references from changing when altering/moving thecell/array | Excel Discussion (Misc queries) | |||
meaning of : IF(Switch; Average(array A, array B); array A) | Excel Worksheet Functions | |||
Constants & Declarations for National Language Support | Excel Programming | |||
Capitalization in Declarations | Excel Programming | |||
Strange variable declarations | Excel Programming |