Hello friends of mrexcel!
I am currently trying to wrap my head around arrays!
I have data written into cells on a worksheet. Each cell holds "rows" and "columns" I would like to write into an array. The "rows" are separated by "/" and the columns are separated by ",".
An example of a cell....
Apple,Banana,Orange,Grape/Carrot,Celery,Tomato,Eggplant/Simon,Lily,Peter,Abby/
I want to form an array using this data...I believe I need to use split in combination with two for loops...but I'm having a lot of trouble setting it up...The desired array would look like...
Apple Banana Orange Grape
Carrot Celery Tomato Eggplant
Simon Lily Peter Abby
What I thought I needed to do is not even close to working...
Here's my code...
could anyone point me in the right direction?
I am currently trying to wrap my head around arrays!
I have data written into cells on a worksheet. Each cell holds "rows" and "columns" I would like to write into an array. The "rows" are separated by "/" and the columns are separated by ",".
An example of a cell....
Apple,Banana,Orange,Grape/Carrot,Celery,Tomato,Eggplant/Simon,Lily,Peter,Abby/
I want to form an array using this data...I believe I need to use split in combination with two for loops...but I'm having a lot of trouble setting it up...The desired array would look like...
Apple Banana Orange Grape
Carrot Celery Tomato Eggplant
Simon Lily Peter Abby
What I thought I needed to do is not even close to working...
Here's my code...
Code:
thedata = ws.range("A1")
splitrows = Split(thedata,"/")
splitcolumns = Split(splitrows,",")
for i = Lbound(splitrows) to Ubound(splitrows)
for j = 1 to 4
[INDENT]splitcolumns = ws.cells(i+1,j)[/INDENT]
next
could anyone point me in the right direction?