title: Excel VBA: Producing all combinations of a range of values
body: <p>I started off over at the math stack exchange to confirm some numbers first (which you'll see later), and now I'm here to try and get some guidance on how to accomplish a (hopefully simple) task in VBA.</p>
  
  <p>Long story short: I have a range A1:A30 with the numbers 1, 2, 3, 4...30. My program currently brings these values into an array, shuffles the array, and then "matches" a[0] with a[1], a[2] with a[3], a[4] with a[5], and so on down the line until each value is paired off. This results in, obviously, 15 matches total.</p>
  
  <p>I've attached a screenshot showing the results on a separate sheet of 21 runs of the program. The trick here is that my code also makes sure that in the leftmost column, all the ID's only have a unique match within their respective row. No duplicates exist. If you follow row 5, you'll see that each value appears only once. You'll also see I've circled in red the matches for a particular run of the program (each column).</p>
  
  <p>The problem is, that my shuffle works great, but 30 numbers means that there are 30 Factorial different possible results of that shuffle. However, it will only require me 29 runs of the program before every number has matched with every other number. </p>
  
  <p>In total, there are 435 possible outcomes of 30 Choose 2. I'd like to produce a sheet similar to my screenshot, outlining all possible 435 outcomes. In other words, I'd like all possible outcomes for any number of n Choose 2.</p>
  
  <p>My question: is there an elegant/concise way to set up some kind of loop to produce all 435 options.</p>
  
  <p>I realize the question may not be 100% clear, so if you require clarification please let me know.</p>
  
  <p><img src="https://i.stack.imgur.com/NBiJM.jpg" alt="Screenshot of the worksheet!"></p>