prototype
07-01-2014, 07:19 PM
Hi,
I would like to know how to populate 27 rows with the 27 permutations of a,b,c (in different columns of each row). So it would look something like
a,a,a
b,a,a
b,b,a
b,b,b
a,b,b
c,a,a
... to 27th row
This would probably require a triple nested loop. This code in javascript does the trick, but I am unable to translate something like it into vba. Here's the javascript code if it helps:
var set = ['a', 'b', 'c'];
var result = [];
var elt = ";
for (var i = 0 < set.length; i++) {
for (var j = 0; j < set.length; j++) {
for (var k = 0; k< set.length; k++) {
elt = set[i] + set[j] + set[k];
result.push(elt);
}
}
}
Thanks for your help!
I would like to know how to populate 27 rows with the 27 permutations of a,b,c (in different columns of each row). So it would look something like
a,a,a
b,a,a
b,b,a
b,b,b
a,b,b
c,a,a
... to 27th row
This would probably require a triple nested loop. This code in javascript does the trick, but I am unable to translate something like it into vba. Here's the javascript code if it helps:
var set = ['a', 'b', 'c'];
var result = [];
var elt = ";
for (var i = 0 < set.length; i++) {
for (var j = 0; j < set.length; j++) {
for (var k = 0; k< set.length; k++) {
elt = set[i] + set[j] + set[k];
result.push(elt);
}
}
}
Thanks for your help!