title: Combination Algorithm in Excel VBA
body: <p>I need an algorithm which generates all possible combination of a set number and output all of them onto Excel spreadsheet.</p>
  
  <p>For example, with n = 5(1,2,3,4,5) and r = 2(created a small gui for this), it will generate all possible combinations and output them into excel spreadsheet like this...</p>
  
  <pre><code>1,2
  1,3
  1,4
  ...
  </code></pre>
  
  <p>The order in which it prints doesn't matter. It can first print (5,1), then (1,2).
  Can anyone show me how to do this?</p>
  
  <p>Thank you very much.</p>