Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Prevent cell/array references from changing when altering/moving thecell/array nme Excel Discussion (Misc queries) 1 September 19th 08 01:53 PM
meaning of : IF(Switch; Average(array A, array B); array A) DXAT Excel Worksheet Functions 1 October 24th 06 06:11 PM
Constants & Declarations for National Language Support Raul[_4_] Excel Programming 2 April 2nd 04 10:42 PM
Capitalization in Declarations Phil Hageman[_3_] Excel Programming 16 December 24th 03 11:01 PM
Strange variable declarations Steven Revell Excel Programming 1 August 19th 03 02:19 PM


All times are GMT +1. The time now is 10:23 PM.

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"