So I have this assignment where I must sort numbers in order. I already made the code and it works, but it doesn't loop at all so I have to manually rerun the program. Here's what I have
Code
Sub SortingNumber()
For i = 1 To 16
For j = 1 To 16
If Cells(j, i) > Cells(j + 1, 2) Then
'swap the two values
Temp = Cells(j, 2)
Cells(j, 2) = Cells(j + 1, 2)
Cells(j + 1, 2) = Temp
Application.Wait (Now + TimeValue("0:00:01"))
End If
Next j
Next i
End Sub
Display More
And the data is in the attachment below.
My question is, how do I make the program loop by itself? I really appreciate any help! Thanks in advance.