Sub trova()
Dim r As Range
Dim tb As Range
Dim risultato As Range
Set r = Range(Cells(1, 1), Cells(10, 1))
Set tb = Range(Cells(10, 3), Cells(14, 3))
Dim k As Integer
k = 1
Do While r.Cells(k).FormulaR1C1 <> ""
Set risultato = tb.Find(r.Cells(k).FormulaR1C1)
If Cells(risultato.Row, risultato.Column + 1).FormulaR1C1 = "" Then Cells(risultato.Row, risultato.Column + 1).FormulaR1C1 = 0
Cells(risultato.Row, risultato.Column + 1).FormulaR1C1 = Cells(risultato.Row, risultato.Column + 1).FormulaR1C1 + 1
k = k + 1
Loop
End Sub
E funziona!L'ultimo numero in fondo è la somma di tutte le presenze, per verificare che fosse uguale al totale di tutte le presenze rilevate nella prima colonna.
Corrisponde tutto, il codice funziona, ed è rapido.

Nessun commento:
Posta un commento