Hi, Kaps kindly gave me this code to work out all the possible 1st,2nd,3rd combinations of a 6 dog race. I am trying to execute it. I have entered it into a module but cannot see it in the Macros. I realise it's something basic but can someone point me in the right direction
Many thanks
Mike
Public Sub List_All_Combinations(N
f_Dogs As Long)
Dim Top_Cell As Range
Dim i As Long
Dim j As Long
Dim k As Long
Dim r As Long
r = 1
Set Top_Cell = Sheets("Sheet1").Range("A1")
For i = 1 To N
f_Dogs
For j = 1 To N
f_Dogs
For k = 1 To N
f_Dogs
If ((i <> j) And (i <> k) And (j <> k)) Then
With Top_Cell.Offset(r, 0)
.Value = i & j & k
End With
With Top_Cell.Offset(r, 1)
.Value = r
End With
r = r + 1
End If
Next k
Next j
Next i
End Sub
Many thanks
Mike
Public Sub List_All_Combinations(N
Dim Top_Cell As Range
Dim i As Long
Dim j As Long
Dim k As Long
Dim r As Long
r = 1
Set Top_Cell = Sheets("Sheet1").Range("A1")
For i = 1 To N
For j = 1 To N
For k = 1 To N
If ((i <> j) And (i <> k) And (j <> k)) Then
With Top_Cell.Offset(r, 0)
.Value = i & j & k
End With
With Top_Cell.Offset(r, 1)
.Value = r
End With
r = r + 1
End If
Next k
Next j
Next i
End Sub