Hi GillesD,
I know that we could use MOD 10 to Calculate the Last Digit or something like :-
LastDigit = A - 10 * Int(A / 10)
I think the code below would be a start :-
The main problem is going to be if there is MORE than one Last Digit in a Combination.
We could use the "Concatenate" Function (&) to string them together and then use the "Large" Function to sort the highest from left to right.
Just a few ideas.
All the Best
PAB

I know that we could use MOD 10 to Calculate the Last Digit or something like :-
LastDigit = A - 10 * Int(A / 10)
I think the code below would be a start :-
Code:
Option Explicit
Option Base 1
Sub Last_Digits()
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
Dim nVal(10) As Double
Dim i As Integer
Application.ScreenUpdating = False
For i = 1 To 10
nVal(i) = 0
Next i
For A = 1 To 44
For B = A + 1 To 45
For C = B + 1 To 46
For D = C + 1 To 47
For E = D + 1 To 48
For F = E + 1 To 49
If nVal = 111111 Then nVal(1) = nVal(1) + 1
If nVal = 211110 Then nVal(2) = nVal(2) + 1
If nVal = 221100 Then nVal(3) = nVal(3) + 1
If nVal = 222000 Then nVal(4) = nVal(4) + 1
If nVal = 311100 Then nVal(5) = nVal(5) + 1
If nVal = 321000 Then nVal(6) = nVal(6) + 1
If nVal = 330000 Then nVal(7) = nVal(7) + 1
If nVal = 411000 Then nVal(8) = nVal(8) + 1
If nVal = 420000 Then nVal(9) = nVal(9) + 1
If nVal = 510000 Then nVal(10) = nVal(10) + 1
Next F
Next E
Next D
Next C
Next B
Next A
Range("B1").Select
For i = 1 To 10
ActiveCell.Offset(i, 0).Value = nVal(i)
Next i
End Sub
We could use the "Concatenate" Function (&) to string them together and then use the "Large" Function to sort the highest from left to right.
Just a few ideas.
All the Best
PAB
