Private Sub CommandButton1_Click()
Sviluppo = WorksheetFunction.Count(Range("AK:AK"))
Application.ScreenUpdating = False
fre = 0
N1 = 0
N2 = 0
For H = 1 To Sviluppo
For X = 1 To 200
For Y = 1 To 5
If Cells(2 + X, 2 + Y) = Cells(2 + H, 37) Then
N1 = X - 2
End If
If Cells(2 + X, 2 + Y) = Cells(2 + H, 37) Then
fre = fre + 1
N2 = X - 1
If Cells(2 + H, 46) = "" Then ' Ritardo
Cells(2 + H, 46) = X - 1 ' Aggiorna Ritardo
Cells(2 + H, 47) = X - 1 ' Primo ritardo Max
End If
B = N2 - N1 - 1
If Cells(2 + H, 47) < B Then
Cells(2 + H, 47) = B 'Aggiorna Ritardo Max
End If
End If
Next Y
Next X
Cells(2 + H, 45) = fre ' Frrquenza
fre = 0
Next H
End Sub |