permutation of values in 2 dimensional array
rw = 1
for each cell1 in cells(2,1).Resize(cells(1,1),1)
for each cell2 in cells(2,2).Resize(cells(1,2),1)
for each cell3 in cells(2,3).Resize(cells(1,3),1)
for each cell4 in cels(2,4).Resize(cells(1,4),1)
with worksheets("sheet2")
.cells(rw,1) = cell1
.Cells(rw,2) = cell2
.Cells(rw,3) = cell3
.Cells(rw,4) = cell4
rw = rw + 1
Next cell4
next cell3
next cell2
next cell1
--
Regards,
Tom Ogilvy
" wrote:
Hi guys,
I have a 2 dimensional array, Positions(x,y), which has a variable
number of rows(x) and columns(y):
e.g. 4 5 3 4
500 500 800 100
450 450 750 50
400 400 700 0
350 350 -50
300
I know the number of columns and the number of rows in each column
(stored in header of column).
How can i obtain permutations of all values in each column.... i.e.
500 500 800 100
500 500 800 50
500 500 800 0
500 500 800 -50
500 500 750 100
.....
.....
.....
350 300 700 0
350 300 700 -50
I am using VBA and outputting the values to fields in excel.
|