Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I refer a macro on a new sheet i just created? | Excel Programming | |||
How does one refer to the n-1 element of a named range? | Excel Discussion (Misc queries) | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
Array problem: Key words-Variant Array, single-element, type mismatch error | Excel Programming | |||
UDF to reference a specific element in an array | Excel Programming |