The following VB sub takes the maximum number of use (0-30), the target value and a range representing the cell in the upper left-hand corner of the output range and generates all combinations matching the target value:
This bit of code calls it (here set to my example of generating all permutations of 0-30 that equal 30 - takes about a minute to run on my machine)
In the test case it generates 46,376 rows of data, which is correct.
It doesn't do anything clever with switching output to new columns, or making sure it doesn't exceed the upper row limit, so if you increase the range above 30 or expand it to more digits it's likely to fail.
Bookmarks