Is it possible for an vba function to return array values and paste in the sheet with excel formula?
For example, I want to write a formula in excel cell say A1 like =GetData()
and press enter. It returns 4 metrics with A1:A4,B1:B4 cells filled in.
I tried Variant and Collection as return types. The values are there but it only populates the first cell.
Function GetData(Input1 As Range) As Variant
Dim value() As Variant
value(1, 1) = "somevalue"
value(1, 2) = "somevalue"
............
value(2, 2) = "somevalue"
GetData = value
End Function