Ok guys, so i've found tons of threads that explain how to fill an excel range from a sub in vb, but none that explains how to do so from a function

Suppose the following function (even if what i have to work with is much more complicated...):

Code:
Option Base 1
Function fill(v As Range) As Double
    
    Dim a(5, 1) As Variant
    
    For i = 1 To 5
        a(i, 1) = i
    Next i
    
    v.Resize(5, 1).Value = a
    
    fill=0

End Function

So, this little program takes the range v, and i want to fill it with values from vector a. It doesn't work, it returns only #VALUE.
Someone knows why, and more important how to make it work?