![]() |
#1
|
|||
|
|||
![]()
Hello,
I hope someone can help me with this. I have 6 letters (later to be used for a yarn crochet project), but I will only use 5 at the time. Then I use another 5, and another 5 and so on. I want them all to be unique. Maybe a routine for the letter A will be enough. I ones followed a Macro and VBA training, and I still can read the most of it, but I miss the skills to really programming. Thanks very much for helping me So I have ABCDEF. I made a little beginning on paper, don't think I can finish this that way :-) Starting with A, is looks like this: ABCDE ABCDF ABCED (note: these are the same as I started with, but they are in a different order) ABCEF ABCFD ABCFE ABDCE ABDEF ABDEC ABDEF ABDFC ABDFE And so on, and so on. |
#2
|
||||
|
||||
![]()
This is specific for 5 chosen out of 6 possibles:
Code:
Sub blah() x = "ABCDEF" y = Len(x) Count = Application.WorksheetFunction.Permut(y, 5) Set Destn = ActiveCell ReDim Results(1 To Count, 1 To 1) idx = 0 ReDim result(1 To 5) For a = 1 To y result(1) = Mid(x, a, 1) For b = 1 To y If b <> a Then result(2) = Mid(x, b, 1) For c = 1 To y If c <> a And c <> b Then result(3) = Mid(x, c, 1) For d = 1 To y If d <> a And d <> b And d <> c Then result(4) = Mid(x, d, 1) For e = 1 To y If e <> a And e <> b And e <> c And e <> d Then result(5) = Mid(x, e, 1) idx = idx + 1 Results(idx, 1) = Join(result, "") End If Next e End If Next d End If Next c End If Next b Next a Destn.Resize(idx) = Results End Sub |
#3
|
|||
|
|||
![]()
thank, thank, thank you so very much!!!!!
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need to match values in one column to values in six others and return the value of a cell from corre | SnakeDoctor | Excel | 4 | 09-09-2024 12:55 PM |
![]() |
olson.jacob720 | Word VBA | 0 | 04-18-2022 10:44 AM |
Table with values from several locations and years - need to find comp values | Ricardo Sousa | Excel | 9 | 07-27-2018 02:06 AM |
![]() |
Ricardo Sousa | Excel | 6 | 06-09-2018 10:51 PM |
finding variations in the data base | adryan | Excel | 4 | 07-15-2015 12:19 AM |