From: Bob Butler on 5 Mar 2010 09:41 "lightdreamer" <lightdreamer(a)discussions.microsoft.com> wrote in message news:4F07AF4D-7C85-4EE9-BBB4-1A4D5544ACFD(a)microsoft.com... > 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 do you mean something like this? Sub tryit() With Sheet1 .Range(.Cells(2, 1), .Cells(2, 5)) = fillit End With End Sub Function fillit() As Long() Dim v(1 To 5) As Long Dim x As Long For x = 1 To 5 v(x) = x * 10 Next fillit = v End Function > Suppose the following function (even if what i have to work with is much > more complicated... and it should fill 3 ranges with 3 different > arrays...): that doesn't make sense to me; a function returns one thing so if I wanted something to fill 3 different values I'd pass them as arguments to a sub and fill them that way you may also find more help in an excel.vb newsgroup since Excel VBA and VB aren't quite the same thing and, apart from Rick, I'm not sure there's much overlap between the groups |