+ Reply to Thread
Results 1 to 3 of 3

array

  1. #1
    ΓΙΑΝΝΗΣ Χ.&Be
    Guest

    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. #2
    Dr. Stephan Kassanke
    Guest

    Re: array


    "??????? ?.?." <@discussions.microsoft.com> schrieb im Newsbeitrag
    news:[email protected]...
    > 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. #3
    Bob Phillips
    Guest

    Re: 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)


    "??????? ?.?." <@discussions.microsoft.com> wrote in message
    news:[email protected]...
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1