Suppose that we have N number or data and we want to put those number or data into a group that contains k number. For example: let A be a set of number {1, 2, 3} and I want to put them into groups that contains 2 number. If I use permutation, I will get {1,2}, {1,3}, {2,1}, {2,3}, {3,1}, and {3,2}. If I use combination, I will get {1,2}, {1,3}, and {2,3}. I want each group is placed in different row and each number in different cells, for example: {1,2} in first row (cells(1,1) = 1 and cells(1,2) = 2), and so on like the example below.
1 | 2
1 | 3
2 | 1
2 | 3
3 | 1
3 | 2
How to make a VBA Excel program to do thing such that?