ماكرو-3
Public Sub sort4()
Dim a(5), C, cup
'Reading Loop
For C = 1 To 5
a(C) = Cells(C, 1)
Next C
'1st process
If a(1) > a(2) Then
cup = a(1): a(1) = a(2): a(2) = cup
End If
'2nd process
If a(1) > a(3) Then
cup = a(1): a(1) = a(3): a(3) = cup
End If
'3rd process
If a(1) > a(4) Then
cup = a(1): a(1) = a(4): a(4) = cup
End If
'4th process
If a(1) > a(5) Then
cup = a(1): a(1) = a(5): a(5) = cup
End If
'Writing Loop
For C = 1 To 5
Cells(C, 3) = a(C)
Next C
End Sub
Dim a(5), C, cup
'Reading Loop
For C = 1 To 5
a(C) = Cells(C, 1)
Next C
'1st process
If a(1) > a(2) Then
cup = a(1): a(1) = a(2): a(2) = cup
End If
'2nd process
If a(1) > a(3) Then
cup = a(1): a(1) = a(3): a(3) = cup
End If
'3rd process
If a(1) > a(4) Then
cup = a(1): a(1) = a(4): a(4) = cup
End If
'4th process
If a(1) > a(5) Then
cup = a(1): a(1) = a(5): a(5) = cup
End If
'Writing Loop
For C = 1 To 5
Cells(C, 3) = a(C)
Next C
End Sub
No comments