Hi. May I suggest the following idea? When you get stuck on similar ideas
on vba arrays, sometimes a good technique is to step thru the code and look
at the "Local" window. In vba, that's View | Locals Window. Step thru code
with F8.
In your original code, you were passing a Range to the function, but you
said that using Va(1), Va(2)...etc was working.
This is confusing because when a range is passed, it usually requires two
dimensions. Example..Va(1,1), or whatever.
There are many ways to write the code, so it's up to you to decide.
Step thru this code to note some differences by looking at the Locals
window.
Notice that v & h use two indexes when refering to a range.
Notice that in the 'a example, the lowest index is 1. However, if you use
'b, then the lowest index is 0.
A three item Vector could be passed using 'c or 'd, but it's ugly.
The function you most likely need is UBound, and LBound. Unfortunately, one
has to trap errors when testing for dimensions in vba.
Note that one of the many bugs (at least on my system) with 2007 is that
UBound & LBound is not listed in the autocomplete feature of vba.
Anyway, try to transpose each vector once, then once again, to see the
changes in the locals window.
Sub Demo()
Dim h, v, a, b, c(), d()
v = Range("A2:A4") 'Verticle
h = Range("A1:C1") 'Horizontal
a = [{1,2,3}]
b = Array(3, 4, 5)
ReDim c(-1 To 1) 'Ugly
ReDim d(-7 To -5) 'Really ugly
Stop
End Sub