ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refer to a specific element of a UDF created array in another UDF? (https://www.excelbanter.com/excel-programming/397845-refer-specific-element-udf-created-array-another-udf.html)

Laurie

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





Gary''s Student

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





Tom Ogilvy

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





Laurie

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






All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com