M
Mike NG
I know this isn't strictly an excel problem, but there may be some neat
way of doing it
I have an array of characters Chars(cSize) - upper limit being
controlled by a constant. Let's say cSize is 5 and the array contains A
B C D E
I need to output Pairs, Triplets, Quads... dynamically depending on the
value of cSize, e.g.
Pairs
AB AC AD AE BC BD BE CD DE DE
Triplets
ABC ABD ABE BCD BCE CDE
Quads
ABCD ABCE BCDE
Pairs are easy as this will always be
for i = 1 to cSize - 1
for j = i+1 to cSize
msgbox chars(i)&chars(j)
next
next
Triples are similar
for i = 1 to cSize - 2
for j = i+1 to cSize -1
for k = j+1 to cSize
msgbox chars(i)&chars(j)&chars(k)
next
next
next
and so on
I don't really want to be coding for all eventualities, so is there any
way of making this general?
way of doing it
I have an array of characters Chars(cSize) - upper limit being
controlled by a constant. Let's say cSize is 5 and the array contains A
B C D E
I need to output Pairs, Triplets, Quads... dynamically depending on the
value of cSize, e.g.
Pairs
AB AC AD AE BC BD BE CD DE DE
Triplets
ABC ABD ABE BCD BCE CDE
Quads
ABCD ABCE BCDE
Pairs are easy as this will always be
for i = 1 to cSize - 1
for j = i+1 to cSize
msgbox chars(i)&chars(j)
next
next
Triples are similar
for i = 1 to cSize - 2
for j = i+1 to cSize -1
for k = j+1 to cSize
msgbox chars(i)&chars(j)&chars(k)
next
next
next
and so on
I don't really want to be coding for all eventualities, so is there any
way of making this general?