Loop to put data in array

hoareau

Board Regular
Joined
Apr 11, 2007
Messages
51
Hello
That is to say a table of 10 out of 10

A1:J10 With a loop I would like that:

line A1:A10 becomes W_1 table
the line b1:b10 becomes W_2 table
the line c1:c10 becomes W_3 table

etc for all the lines, with the corresponding data of each line

Thank you
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I understand that you have "Columns" of data Ten [10] "Rows" each.

I do not know what it is you want to do with this data?
Also, do you want a Sheet-Formula solution or a VBA code solution?

What data do you have and what data do you want to end up with and where?
 
Upvote 0
Loop to put data in array


i want a vba solution

the data are number

Ex:

Row 1 : 1 2 3 4 5
rows 2 : 1 2 3 4 5 6 7
row 3: 5 6 7 8 9 10 11

W_ & row 1 =W_1(1 2 3 4 5)
W_ & row 2 =W_2(1 2 3 4 5 6 7)
W_ & row 3 =W_3(5 6 7 8 9 10 11)

if there are 100 lines 100 array with W_ & row number

I want for each row a array with the numbers which corespondent has the line

have another series of number in a named table "bases" with 4 digits, I want to add the table bases has each new table to know the number of figure different in memory.

Base(1 2 3 4)+W_1(1 2 3 4 5 )= 1 différent digit
Base(1 2 3 4)+W_2(1 2 3 4 5 6 7)= 3 différents digits


if the difference corresponds has what I want, the table will be written on the Excel sheet

thank you
 
Upvote 0
Code:
Dim dataRRay as Variant
dataRRay = Range("a1:j10").Value
will return dataRRay as a 10 X 10 array containing the values in A1:J10

Code:
Dim row1data As Variant
row1data=Application.Index(dataRRay,1,0)
will return the array row1data of 10 elements consising of the first row of datarray.
Similarly,
Code:
Dim row2data As Variant, col4data As Variant
row2data=Application.Index(dataRRay,2,0)
col4data=Application.Index(dataRRay,0,4)
will return the second row and the fourth columns as their own arrays.

The use of INDEX to extract row and column arrays from 2-dimensional arrays fails when the 2-dimensional array has more than aprox 3,000 elements total.
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top