Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Public Array

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Public Array

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


Brent McIntyre wrote:

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Public Array

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.

--
Regards,
Tom Ogilvy


"keepitcool" wrote in message
...
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


Brent McIntyre wrote:

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Public Array

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


"Tom Ogilvy" wrote:

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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Public Array

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.

--
Regards,
Tom Ogilvy

"keepitcool" wrote in message
...
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


"Tom Ogilvy" wrote:

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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Public Array

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
protect public sub johnny Excel Discussion (Misc queries) 2 April 23rd 08 07:04 PM
public variables johnny Excel Discussion (Misc queries) 7 February 27th 08 03:44 PM
Public variables johnny Excel Discussion (Misc queries) 2 February 24th 08 05:05 AM
Public Variables Jerry McNabb Excel Discussion (Misc queries) 0 February 24th 08 01:26 AM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


All times are GMT +1. The time now is 10:31 AM.

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"