ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   array (https://www.excelbanter.com/excel-programming/329034-array.html)

JMG[_2_]

array
 
Any tip to test the lenght of an array ?


nLenArray = 100
nColArray = 4
Redim tSociety(nLenArray,nColArray)

For x = 1 to nLenArray
For j = 1 to nColArray
next
next


Why not possible
for x = 1 to len(tSociety()) or something similar?


Vasant Nanavati

array
 
I think you're referring to dimensions. Look at the LBound and UBound
functions.

--

Vasant

"JMG" wrote in message
oups.com...
Any tip to test the lenght of an array ?


nLenArray = 100
nColArray = 4
Redim tSociety(nLenArray,nColArray)

For x = 1 to nLenArray
For j = 1 to nColArray
next
next


Why not possible
for x = 1 to len(tSociety()) or something similar?




K Dales[_2_]

array
 
The UBound function does just what you want. UBound(tSociety,1) gives the
first dimension, UBound(tSociety,2) gives the second.

"JMG" wrote:

Any tip to test the lenght of an array ?


nLenArray = 100
nColArray = 4
Redim tSociety(nLenArray,nColArray)

For x = 1 to nLenArray
For j = 1 to nColArray
next
next


Why not possible
for x = 1 to len(tSociety()) or something similar?



Bob Phillips[_7_]

array
 
UBound(tSociety) - LBound(tSociety) + 1 to get the length

For x = LBound(tSociety) To UBound(tSociety)

to loop through it

--
HTH

Bob Phillips

"JMG" wrote in message
oups.com...
Any tip to test the lenght of an array ?


nLenArray = 100
nColArray = 4
Redim tSociety(nLenArray,nColArray)

For x = 1 to nLenArray
For j = 1 to nColArray
next
next


Why not possible
for x = 1 to len(tSociety()) or something similar?





All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com