This works but crashes randomly ? (go figure) I think my sort routine is at least part of the problem.
Option Explicit
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, T As Long
Sub List_5x59()
' Macro to Count the number of tries it takes to match lotto #s
T = 0
Sheets("Sheet1").Select
Selection.ColumnWidth = 14
Application.ScreenUpdating = True
Randomize
5
Range("B1").Select
' Start of loops for 5 variables (A-E)
10
A = Int(55 * Rnd + 1)
B = Int(56 * Rnd + 1)
C = Int(57 * Rnd + 1)
D = Int(58 * Rnd + 1)
E = Int(59 * Rnd + 1)
If A >= B Then GoTo 10
If B >= C Then GoTo 10
If C >= D Then GoTo 10
If D >= E Then GoTo 10
' Copying the combination in the form of N1-N2-N3-N4-N5 into cell "B1"
T = T + 1 'incriment # of Tries.
ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & ""
Range("C1").Select
ActiveCell.Value = T
If ("A1") = ("B1") Then GoTo 14
GoTo 5
'Move down to the next set of numbers.
14
T = 0
15
Range("B2").Select
' Start of loops for 5 variables (A-E)
20
Randomize
A = Int(59 * Rnd + 1)
B = Int(59 * Rnd + 1)
C = Int(59 * Rnd + 1)
D = Int(59 * Rnd + 1)
E = Int(59 * Rnd + 1)
If A >= B Then GoTo 20
If B >= C Then GoTo 20
If C >= D Then GoTo 20
If D >= E Then GoTo 20
' Copying the combination in the form of N1-N2-N3-N4-N5 into cell "B1"
T = T + 1 'incriment # of Tries.
ActiveCell.Value = Application.WorksheetFunction.Text(A, "00") & "-" _
& Application.WorksheetFunction.Text(B, "00") & "-" _
& Application.WorksheetFunction.Text(C, "00") & "-" _
& Application.WorksheetFunction.Text(D, "00") & "-" _
& Application.WorksheetFunction.Text(E, "00") & ""
Range("C2").Select
ActiveCell.Value = T
If ("A2") = ("B2") Then End
GoTo 15
End Sub