Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Refer to a specific element of a UDF created array in another UDF?

Yesterday I asked about how to create a UDF resulting in an array (one or two
dimensional).

Thanks for the big help, Chip, Dick and Gary''s Student!!

Now I know how to create a UDF returning arrays (one or two dimensional),
which is great and is what I was exactly looking for.

The next question is that how I can refer to the UDF resulted arrays in
another
UDF to do other calculations? Like referring to a specific element in the
array one at a time in another UDF.


Thanks for those having already helped me again and for those going to help
me in advance!!!!!!

Sincerely,
Laurie




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Refer to a specific element of a UDF created array in another UDF?

Once again as easy as one...two...three:

Function laurie() As Variant
v = Array(1, 2, 3)
laurie = v
End Function

Sub main()
Dim s As Variant
s = laurie()
MsgBox (s(0) & s(1) & s(2))
End Sub

you don't even need to Dim s as an array in the main routine.
--
Gary''s Student - gsnu200745


"Laurie" wrote:

Yesterday I asked about how to create a UDF resulting in an array (one or two
dimensional).

Thanks for the big help, Chip, Dick and Gary''s Student!!

Now I know how to create a UDF returning arrays (one or two dimensional),
which is great and is what I was exactly looking for.

The next question is that how I can refer to the UDF resulted arrays in
another
UDF to do other calculations? Like referring to a specific element in the
array one at a time in another UDF.


Thanks for those having already helped me again and for those going to help
me in advance!!!!!!

Sincerely,
Laurie




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Refer to a specific element of a UDF created array in another

Just to add.
you don't even need to Dim s as an array in the main routine.


No, but it better be a variant; the preferred method is to Dim it as Variant.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

Once again as easy as one...two...three:

Function laurie() As Variant
v = Array(1, 2, 3)
laurie = v
End Function

Sub main()
Dim s As Variant
s = laurie()
MsgBox (s(0) & s(1) & s(2))
End Sub

you don't even need to Dim s as an array in the main routine.
--
Gary''s Student - gsnu200745


"Laurie" wrote:

Yesterday I asked about how to create a UDF resulting in an array (one or two
dimensional).

Thanks for the big help, Chip, Dick and Gary''s Student!!

Now I know how to create a UDF returning arrays (one or two dimensional),
which is great and is what I was exactly looking for.

The next question is that how I can refer to the UDF resulted arrays in
another
UDF to do other calculations? Like referring to a specific element in the
array one at a time in another UDF.


Thanks for those having already helped me again and for those going to help
me in advance!!!!!!

Sincerely,
Laurie




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Refer to a specific element of a UDF created array in another

Thank you both!!!

I will look into it.
I guess I am ready to take on the task now.

Thank you all for the very kind help again!!!

Laurie



"Tom Ogilvy" wrote:

Just to add.
you don't even need to Dim s as an array in the main routine.


No, but it better be a variant; the preferred method is to Dim it as Variant.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

Once again as easy as one...two...three:

Function laurie() As Variant
v = Array(1, 2, 3)
laurie = v
End Function

Sub main()
Dim s As Variant
s = laurie()
MsgBox (s(0) & s(1) & s(2))
End Sub

you don't even need to Dim s as an array in the main routine.
--
Gary''s Student - gsnu200745


"Laurie" wrote:

Yesterday I asked about how to create a UDF resulting in an array (one or two
dimensional).

Thanks for the big help, Chip, Dick and Gary''s Student!!

Now I know how to create a UDF returning arrays (one or two dimensional),
which is great and is what I was exactly looking for.

The next question is that how I can refer to the UDF resulted arrays in
another
UDF to do other calculations? Like referring to a specific element in the
array one at a time in another UDF.


Thanks for those having already helped me again and for those going to help
me in advance!!!!!!

Sincerely,
Laurie




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
How do I refer a macro on a new sheet i just created? Joe Excel Programming 1 July 23rd 07 12:10 AM
How does one refer to the n-1 element of a named range? Charles Hewitt Excel Discussion (Misc queries) 2 November 26th 05 06:56 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 6 November 9th 05 05:54 AM
Array problem: Key words-Variant Array, single-element, type mismatch error davidm Excel Programming 1 November 8th 05 04:21 AM
UDF to reference a specific element in an array GH[_2_] Excel Programming 4 January 8th 05 12:55 PM


All times are GMT +1. The time now is 04:25 PM.

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"