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

Hi All,

I have defined the following variables type:

Type XXX
Var1 as double
Var2 as double
End Type

Public XYZ(10) as XXX

How can I pass the array XYZ to a function?

Funcationname(XYZ ) doesn't seems like working

Thanks.

--
Gian
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Passing Array to function

That's ok, good work!
Ste'
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
Passing array elements to a function Geoff Excel Programming 2 May 23rd 08 05:30 PM
Passing indexed array value to VBA function [email protected] Excel Programming 7 August 9th 06 12:57 AM
Passing array from Access to Excel function Dale[_15_] Excel Programming 5 September 29th 05 07:30 PM
Passing array of strings from DLL function to VBA Jag Man Excel Programming 0 January 12th 04 10:09 PM
Passing array to a function GB[_3_] Excel Programming 3 October 21st 03 09:59 AM


All times are GMT +1. The time now is 04:57 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"