
Private Sub Classifica_Click()
Dim arry(1 To 1000, 1 To 2) As String
For a = 2 To 1000
If Worksheets("Iscrizioni").Cells(a, 9) <> "" Then
team = Worksheets("Iscrizioni").Cells(a, 9)
For b = 1 To 500
If arry(b, 1) <> "" Then
If arry(b, 1) = team Then
arry(b, 2) = arry(b, 2) + 1
Exit For
End If
Else
arry(b, 1) = team
totale = arry(b, 2)
If totale = "" Then totale = 0
arry(b, 2) = totale + 1
Exit For
End If
Next
Else
Exit For
End If
Next
For b = 1 To 999
If arry(b, 1) <> "" Then
team = arry(b, 1)
maxim = CInt(arry(b, 2))
For a = b + 1 To 1000
If arry(a, 1) <> "" Then
If maxim < CInt(arry(a, 2)) Then
tempteam = arry(a, 1)
tempscore = arry(a, 2)
arry(a, 1) = arry(b, 1)
arry(a, 2) = arry(b, 2)
arry(b, 1) = tempteam
arry(b, 2) = tempscore
team = arry(b, 1)
maxim = CInt(arry(b, 2))
End If
Else
Exit For
End If
Next
Else
Exit For
End If
conta = conta + 1
Worksheets("10_TEAM_PRESENTI").Cells(2 + conta, 10) = arry(b, 1)
Worksheets("10_TEAM_PRESENTI").Cells(2 + conta, 12) = arry(b, 2)
Next
End Sub
|
Private Sub Classifica_Click()
Dim arry(1 To 1000, 1 To 2) As String
For a = 2 To 1000
If Worksheets("Iscrizioni").Cells(a, 9) <> "" Then
team = Worksheets("Iscrizioni").Cells(a, 9)
For b = 1 To 500
If arry(b, 1) <> "" Then
If arry(b, 1) = team Then
arry(b, 2) = arry(b, 2) + 1
Exit For
End If
Else
arry(b, 1) = team
totale = arry(b, 2)
If totale = "" Then totale = 0
arry(b, 2) = totale + 1
Exit For
End If
Next
End If
Next
For b = 1 To 999
If arry(b, 1) <> "" Then
team = arry(b, 1)
maxim = CInt(arry(b, 2))
For a = b + 1 To 1000
If arry(a, 1) <> "" Then
If maxim < CInt(arry(a, 2)) Then
tempteam = arry(a, 1)
tempscore = arry(a, 2)
arry(a, 1) = arry(b, 1)
arry(a, 2) = arry(b, 2)
arry(b, 1) = tempteam
arry(b, 2) = tempscore
team = arry(b, 1)
maxim = CInt(arry(b, 2))
End If
Else
Exit For
End If
Next
Else
Exit For
End If
conta = conta + 1
Worksheets("10_TEAM_PRESENTI").Cells(2 + conta, 10) = arry(b, 1)
Worksheets("10_TEAM_PRESENTI").Cells(2 + conta, 12) = arry(b, 2)
Next
End Sub
|
Sub trova()
Dim ma()
Dim pos1, pos2, c, i As Long
Dim fin1, fin2 As Range
ReDim ma(0)
pos1 = InputBox("Inserire il corridore 1: ")
pos2 = InputBox("Inserire il corridore 2: ")
If pos1 <> "" And pos2 <> "" Then
Set fin1 = Columns(2).Find(What:=pos1, LookAt:=xlWhole)
Set fin2 = Columns(2).Find(What:=pos2, LookAt:=xlWhole)
If Not fin1 Is Nothing And Not fin2 Is Nothing Then
c = Cells(1, Columns.Count).End(xlToLeft).Column
For i = 2 To c
ma(UBound(ma)) = Cells(fin1.Row, i)
ReDim Preserve ma(UBound(ma) + 1)
Next
Range(Cells(fin1.Row, 2), Cells(fin1.Row, c)) = Range(Cells(fin2.Row, 2), Cells(fin2.Row, c)).Value
For i = 1 To UBound(ma)
Cells(fin2.Row, i + 1) = ma(i - 1)
Next
Else
MsgBox "Corridori non trovati."
End If
Else
MsgBox "Valori non validi."
End If
End Sub |
Sub trova()
Dim ma()
Dim pos1, pos2, c, i As Long
Dim fin1, fin2 As Range
ReDim ma(0)
pos1 = InputBox("Inserire il corridore 1: ")
pos2 = InputBox("Inserire il corridore 2: ")
If pos1 <> "" And pos2 <> "" Then
Set fin1 = Columns(2).Find(What:=pos1, LookAt:=xlWhole)
Set fin2 = Columns(2).Find(What:=pos2, LookAt:=xlWhole)
If Not fin1 Is Nothing And Not fin2 Is Nothing Then
c = 9
For i = 2 To c
ma(UBound(ma)) = Cells(fin1.Row, i)
ReDim Preserve ma(UBound(ma) + 1)
Next
Range(Cells(fin1.Row, 2), Cells(fin1.Row, c)) = Range(Cells(fin2.Row, 2), Cells(fin2.Row, c)).Value
For i = 1 To UBound(ma)
Cells(fin2.Row, i + 1) = ma(i - 1)
Next
Else
MsgBox "Corridori non trovati."
End If
Else
MsgBox "Valori non validi."
End If
End Sub
|
