View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gian Gian is offline
external usenet poster
 
Posts: 15
Default Passing Array to function

Thanks SteAXA. I know what I did wrong.
--
Gian


"SteAXA" wrote:

I try this:

Type XXX
Var1 As Double
Var2 As Double
End Type

Public XYZ(10) As XXX

Sub macro_1()
XYZ(0).Var1 = 11
XYZ(0).Var2 = 12
XYZ(1).Var1 = 21
XYZ(1).Var2 = 22
XYZ(2).Var1 = 31
XYZ(2).Var2 = 32

TryToPass XYZ

End Sub

Function TryToPass(ByRef aaa() As XXX)
Dim ncount As Integer
Dim Toshow
ncount = 0
While Not (ncount 10)
Toshow = aaa(ncount).Var1 & " " & aaa(ncount).Var2
MsgBox Toshow
ncount = ncount + 1
Wend
End Function

It seems to work well, maybe i don't understand your problem.