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

In one module, I have written 3 VBA functions.
In each VBA function I have 10 arrays as follow:
Dim Aarr() As Variant: Aarr = Array("a", "¸b", "c", "d")
Dim Barr() As Variant: Barr = Array("aa", "¸bb", "cc", "dd")
Etc
The 10 arrays are exactly the same for the 3 functions and I repeat them for
each function.
Is there away to write only once the arrays in the module in order to work
for the 3 VBA functions?

Τhanks, for the answer.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default array


"??????? ?.?." schrieb im Newsbeitrag
...
In one module, I have written 3 VBA functions.
In each VBA function I have 10 arrays as follow:
Dim Aarr() As Variant: Aarr = Array("a", "b", "c", "d")
Dim Barr() As Variant: Barr = Array("aa", "bb", "cc", "dd")
Etc.
The 10 arrays are exactly the same for the 3 functions and I repeat them
for
each function.
Is there away to write only once the arrays in the module in order to work
for the 3 VBA functions?


Declare the arrays on module level instead of declaring them for each
function, thus you will get public variables.

cheers,
Stephan


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

Declare the variables as private variables before the 3 functions, they will
then be in scope of all 3

Private Aarr() As Variant
etc.

Sub rtn1()
....
End Sub

and so on

--

HTH

RP
(remove nothere from the email address if mailing direct)


"??????? ?.?." wrote in message
...
In one module, I have written 3 VBA functions.
In each VBA function I have 10 arrays as follow:
Dim Aarr() As Variant: Aarr = Array("a", "b", "c", "d")
Dim Barr() As Variant: Barr = Array("aa", "bb", "cc", "dd")
Etc.
The 10 arrays are exactly the same for the 3 functions and I repeat them

for
each function.
Is there away to write only once the arrays in the module in order to work
for the 3 VBA functions?

?hanks, for the answer.



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
Complex conditional summing - array COUNT works, array SUM gives#VALUE fatcatfan Excel Worksheet Functions 4 November 18th 09 06:41 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
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
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


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