ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   LOOPING THROUGH A 2-D STRING ARRAY !!! (https://www.excelbanter.com/excel-programming/432209-looping-through-2-d-string-array.html)

Jay Dean

LOOPING THROUGH A 2-D STRING ARRAY !!!
 
Hello !

I have a 2D string array, MyArray(110, 140). How do I loop through ONLY
the 2nd dimension (the 141 columns) referring to ALL the 111 rows in
EACH column as a SINGLE 1D array of (111 by 1) ?

Any help will be appreciated.

Thanks
Jay Dean


*** Sent via Developersdex http://www.developersdex.com ***

joel

LOOPING THROUGH A 2-D STRING ARRAY !!!
 

for i = lbound(MyArray,1) to ubound(MyArray,1)
for j = lbound(MyArray,2) to ubound(MyArray,2)
MyChar = MyArray(i,j)
next j
next i
next i


It may be better to use a single dimension array with each items in the
array is a string and usew the MID function to get each character

Dim MyArray(110) as String

for i = lbound(MyArray,1) to ubound(MyArray,1)
for j = 1 to len(MyArray(i))
Mychar = Mid(MyArray(i),1)
next j
next i

"jay dean" wrote:

Hello !

I have a 2D string array, MyArray(110, 140). How do I loop through ONLY
the 2nd dimension (the 141 columns) referring to ALL the 111 rows in
EACH column as a SINGLE 1D array of (111 by 1) ?

Any help will be appreciated.

Thanks
Jay Dean


*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 06:21 AM.

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