View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E[_2_] AA2e72E[_2_] is offline
external usenet poster
 
Posts: 93
Default Variant as matrix

The easiest way to address every element without knowing its rank (how many dimensions it has) of any matrix is

For each Element in MyMatri
... your cod
Nex

This would not be suitable if you want to reassign to MyMatrix

LBound(MyMatrix) gives the starting index of a 1-dimensional matrix; UBouund the last
LBound(mymatrix,1) dives the starting index on the first dimension etc. Any reference to a non-existent dimension is an error

There is no way to query the number of dimensions in a matrix

Depending on how the variant matrix is created, its starting index on any dimension is 0 when created using Split or Array, irrespective of Option Base