The following function will return the number of dimensions in an array. It
will return 0 if the variable is not an array or is an unallocated array.
Function NumBounds(V As Variant) As Long
Dim N As Long
Dim LB As Long
On Error Resume Next
Do Until Err.Number < 0
N = N + 1
LB = LBound(V, N)
Loop
NumBounds = N - 1
End Function
--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
"witek" wrote in message
...
Hi guys.
Here it is
dim v as variant
v = Range("a1").Value gives me ordinal type of variant v (double,
string ... etc)
v = Range("a1:a5").Value gives me 1-dimensional array
v = Range ("a1:c1").Value gives me 2-dimensional array
sub a (rng as range)
v = rng.value gives me .....?????
end sub
questions
1. does anybody know how to always have 2-dimensional array in v=
rng.value ?
2. Does anybody know how to find dimension of variant if I even don't know
if it is an array
2. Does anybody know how to make 2-dim array from a number or 1-dim
array?
Thanks for help.