You may use simple recursive macro which starts with
1) one element in an array (A), and rest in string of letters to be processed then
2) if the string to be processed is empty finishes activity, if not takes first letter of string to be processed, and
3) adds it in front and in back of each element in an array, producing twice as long array as an original one
4) writes this array into worksheet below earlier version (or could be overwriting previous one, if you don't need partial results)
5) removes used letter from the string to be processed and
6) returns to step 2 using this shorter string and array which has been created in step 3
The limit is 21 elements, like ABCDEFGHIJKLMNOPQGRST in C1 (in case of only final results, because if partial results are needed too, then 20 elements), because
because of filling whole column in excel sheet (1048576 rows). But even with such large number macro works almost instantenously.
The code assuming all elements list is in cell C1 could look like this:
See how it works in attached file.
And here is the version presenting only final results (full length)
Bookmarks