Hi all,
I have a list of letters in a column ie. A2 = A, A3 = B, A4 = C and so on.
What I want to do is add all of these letters to a drop down validation list in a cell.
I can do this fairly easily but only by adding each row as a different value (i.e. the user will have to chose between A, B or C).
What I want is for the user to be able to chose any combination of the letters (i.e. AB, AC, BC, etc).
I have found the following example on the internet:
However, this does not return only the unique combinations (i.e. it returns ABC and CBA).![]()
Sub main() Dim x As Long, sKills As String For x = 2 To Sheets(1).Range("C65536").End(xlUp).Row sKills = sKills & Sheets(2).Cells(x, 3) Next x ShowCombinations "", sKills End Sub Sub ShowCombinations(strPrefix As String, strMain As String) If strMain = "" Then Debug.Print strPrefix Exit Sub End If Dim strFirst As String, strRest As String strFirst = Left(strMain, 1) strRest = Mid(strMain, 2) ShowCombinations strPrefix & strFirst, strRest ShowCombinations strPrefix, strRest End Sub
Can anyone advise me on how to do this?
Once I have all of the possible combinations, my plan is to use them to create a string and add that to the validation list in the cell.
I hope all of this makes sense?
Bookmarks