Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a sub which calls a second sub. The second sub
loads an array. I want to pass the entire array back up to the first sub when the second sub is completed. How do I this assuming that I do not want to make the array a public array? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ExcelMonkey,
1) Dimension the Array as Private within the module containing the two subs or 2) Pas the Array ByRef to the second sub Sub FirstSub() Dim i As Integer Dim myArray(1 To 10) As String 'Pass the array to the second sub SecondSub myArray For i = 1 To 10 MsgBox myArray(i) Next i End Sub Sub SecondSub(ByRef myArray2 As Variant) Dim i As Integer 'Modify the array For i = 1 To 10 myArray2(i) = "Test " & i Next i End Sub HTH, Bernie MS Excel MVP "ExcelMonkey" wrote in message ... I have a sub which calls a second sub. The second sub loads an array. I want to pass the entire array back up to the first sub when the second sub is completed. How do I this assuming that I do not want to make the array a public array? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Bernie
-----Original Message----- ExcelMonkey, 1) Dimension the Array as Private within the module containing the two subs or 2) Pas the Array ByRef to the second sub Sub FirstSub() Dim i As Integer Dim myArray(1 To 10) As String 'Pass the array to the second sub SecondSub myArray For i = 1 To 10 MsgBox myArray(i) Next i End Sub Sub SecondSub(ByRef myArray2 As Variant) Dim i As Integer 'Modify the array For i = 1 To 10 myArray2(i) = "Test " & i Next i End Sub HTH, Bernie MS Excel MVP "ExcelMonkey" wrote in message ... I have a sub which calls a second sub. The second sub loads an array. I want to pass the entire array back up to the first sub when the second sub is completed. How do I this assuming that I do not want to make the array a public array? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need help passing an array as an argument | Excel Programming | |||
PASSING an array to a sub in VBA | Excel Programming | |||
Passing data back from a form | Excel Programming | |||
Passing data back from a form | Excel Programming | |||
Passing data back from a form | Excel Programming |