Hi,
Is it possible for a function to return an array...and how?
Any help would be appreciated.
Thank you
Jean-Pierre Bidon
Hi,
Is it possible for a function to return an array...and how?
Any help would be appreciated.
Thank you
Jean-Pierre Bidon
Yep. You can have the array returned to that single cell or to a range of
cells.
Option Explicit
Function testme() As Variant
Dim iCtr As Long
Dim myArr(1 To 10) As String
For iCtr = 1 To 10
myArr(iCtr) = "test" & iCtr
Next iCtr
testme = Application.Transpose(myArr)
End Function
Select A1:A10, type =testme() and hit ctrl-shift-enter.
Jean-Pierre Bidon wrote:
>
> Hi,
> Is it possible for a function to return an array...and how?
> Any help would be appreciated.
> Thank you
> Jean-Pierre Bidon
--
Dave Peterson
I tried your solution and it works.
Thank you Dave.
Jean-Pierre
"Dave Peterson" <[email protected]> a écrit dans le message de news:
[email protected]...
> Yep. You can have the array returned to that single cell or to a range of
> cells.
>
> Option Explicit
> Function testme() As Variant
>
> Dim iCtr As Long
> Dim myArr(1 To 10) As String
>
> For iCtr = 1 To 10
> myArr(iCtr) = "test" & iCtr
> Next iCtr
>
> testme = Application.Transpose(myArr)
>
> End Function
>
> Select A1:A10, type =testme() and hit ctrl-shift-enter.
>
> Jean-Pierre Bidon wrote:
>>
>> Hi,
>> Is it possible for a function to return an array...and how?
>> Any help would be appreciated.
>> Thank you
>> Jean-Pierre Bidon
>
> --
>
> Dave Peterson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks