A quick example of a Shared array declared in main code and how to pass an array out from a Function along with another value
Code: (Select All)
Dim Shared mySharedArray(1 To 20) As Long
For i = 1 To 20
mySharedArray(i) = i * i
Next
ReDim out10(1 To 10) As Integer
first10Plus5 = first10squaresPlus&(5, out10())
For i = 1 To 10
Print out10(i)
Next
Print "Total was: "; first10Plus5
Function first10squaresPlus& (X, outputFirst10() As Integer)
For i = 1 To 10
outputFirst10(i) = mySharedArray(i) + X
tot& = tot& + outputFirst10(i)
Next
first10squaresPlus& = tot&
End Function
b = b + ...