Hi everybody ,
I have a macro that lists all possible pairing combinations from a list
Of names. As its name (pairing combinations) implies, each combination is made up of 2 names.
How can I modify this macro so that it doesn’t restrict me to 2 names per combination , say 3 or 4 per combination.
Please refer to attached file to see an example & its related code (module1)
Thanx in advance
Combinations From A List
-
-
Re: Combinations From A List
Hi,
what result do youwant to become? Like this:
John Mike Robert Evan
John Mike Robert Nick
....Gollem
-
Re: Combinations From A List
Amer,
Attached is a modified version of your workbook that does what you need. The code uses a recursive call to a loop to create the list and a counter, intDepth to count the number of times the loop has been called.
I have defined variables as integers, if you have a long list of names and many players in a game then you will need to possibly change some of the types to long. Also there is a line that uses the worksheet function Combin, this may get upset by large numbers to.
The named area of the list of names is a dynamic named range, as is the results area.
Edit the blue cell for the number of players, this is also a named cell.
HTH,
Alan.
-
Re: Combinations From A List
Hi there
Here is a solution to your problem. Could probably be fine-tuned by some whiz, but certainly does what you want. It works for up to 16 names, which you enter in the blue cells.
Have fun
Cheers
KiwiSteve
-
Re: Combinations From A List
Thanks Very Much Guys
I Got Exactly What I Need By
Looking At The Modifications You've Done
Gollum , I Am Really Sorry I Didnt Get Back
To U Quickly , Its Been 2 Days I Didnt Check
The Forum.
Tahnx Again Guys & I Do Really Appreciate Ur Help -
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!