1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Sub RunMe()
Range("A1").Select
Comb 26, 4, 1, " ' "
For n = 90 To 65 Step -1
repl = Chr(n)
Range("A:A").Replace What:=n - 64 & " ", Replacement:=repl, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
Range("A1").Select
End Sub
Sub Comb(ByVal n As Integer, ByVal m As Integer, _
ByVal k As Integer, ByVal s As String)
If m > n - k + 1 Then Exit Sub
If m = 0 Then
ActiveCell = s
ActiveCell.Offset(1, 0).Select
Exit Sub
End If
Comb n, m - 1, k + 1, s & k & " "
Comb n, m, k + 1, s
End Sub |
Partager