Hi,
Calling me a programmer of any sort would be a gross exaggeration.

After selecting a list of ten (or more or less, though I can put a lower and upper cap on the number in the list) numbers from an excel spreadsheet, I need to take EVERY possible combination of these numbers (choosing each number only once in each combination) and run through a program which then compares the sum of index values on the excel spreadsheet.
The issue I'm having is the actual generation of each combination of the numbers. I have a column of ten cells, and I need to generate each possible combination (yes, all ten factorial). I will be comparing the sums, and choosing the lowest total sum. Each transition has a value associated with it, so the transition 1->2 might be less than 3->4 or 1->4.
To be clear, I have a column of ten cells which correspond to a table in the spreadsheet.
As for the comparing the sums, I think that is simple:

VB Code:
  1. ii = Factorial(Val(NumVals.Text))
  2. LeastVal=1000000000
  3. For ii = 1 to ii
  4. CurrentVal = Function(...)
  5. ‘??? can't figure out how to generate each combination. I am thinking a whole new function which generates the sequence and the interrogates the spreadsheet.
  6. If  CurrentVal < LeastVal Then
  7. LeastVal = CurrentVal
  8. LeastNum1 = CurrentNumA ‘etc.
  9. Next ii
  10. Else
  11. Next ii
  12. End If

I know for a fact that the sums will be lower than, say, a billion, so I set the first least # to that so it will be instantly replaced. I store the information about the best combo so far in the 'Least' series variables, and replace it if I find a new best combination. Any ideas on what my function should look like?
(I have already coded in the simple factorial function that I call.)

Also, I am concerned that my program might take, say, forever to run. I don't have enough practical experience to know whether this is a valid concern or not, in this case, but 10! = 3.63 million or so. And if my list is longer, that number goes way up...

Thanks in advance for any advice,
Bartender