Public Array

  • Thread starter Thread starter Brent McIntyre
  • Start date Start date
B

Brent McIntyre

To whom it may concern,

I am trying to set a multi dimensional array that can be updated by all
procedures then exported at the end. Does anyone know if I can do this
?

ie

Private Sub UPDATE1()
Set MultiDimensionalArray(1,0) = "Frank"
End Sub

Private Sub UPDATE2()
MultiDimensionalArray(1,1) = "Megan"
End Sub

Public Sub MultiDimensionalArray()
End Sub

Any help you may be able to provide would be much appreciated.

Yours sincerely,

Brent McIntyre
 
Brent,

a piece of advice:
you'll save yourself a lot of frustration by understanding concepts.
(a glance at your post shows you've smelled the milk but cant find the
nipple . Freely translated from the Dutch language :)

Can't see the diff between an array and a procedure ?

Declare your array in the top of your code, then it becomes accessible
to all procedures.

Dim myArray(10,10) as string

sub do1
myArray(2,2)="john"
end sub

sub get1
msgbox myArray(2,2)
end sub






keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
I think you would need to declare it Public.

Public myArray(10,10) as string

sub do1()
myArray(2,2)="john"
end sub

sub get1()
msgbox myArray(2,2)
end sub

to see it in other modules.
 
Tom,

I should have mentioned "to all procedures within this module".
The point wasn't whether to declare it public or private but rather to
declare it (at module level) and not confuse it with Sub MyArray().


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
The OP said
I am trying to set a multi dimensional array that can be updated by all
procedures

I had recollected this to be multiple modules and thus my suggestion -
however, going back and reading it specifically, there is no reason to
believe that is what was meant.
 
Thanks guys your information has helped, I guessed this is what I needed
to do but once again I had trouble locating help on this actual method.

Just to clear up the confusion, I do need to be able to see the array
from other modules, so thanks Tom for your help there.

Keep up the good work !

Yours sincerely,

Brent McIntyre
 
Back
Top