Sub Addition()
Dim fin&, i&, col2&, lot&, v&
col2 = Range("j" & Rows.Count).End(xlUp).Row
fin = Range("c" & Rows.Count).End(xlUp).Row
For i = 2 To col2
For v = 2 To fin
If Cells(i, 10) = Cells(v, 3) Then
If Cells(i, 10) = Cells(v, 3) And Cells(i, 12) + Cells(v, 5) >= 100 Then
Cells(i, 12) = Cells(i, 12) + Cells(v, 5) - 100
Cells(i, 11) = Cells(i, 11) + Cells(v, 4) + TimeValue("00:00:01")
Cells(i, 11) = Round(Cells(i, 11), 10)
Exit For
Else
Cells(i, 12) = Cells(i, 12) + Cells(v, 5)
Cells(i, 11) = Round(Cells(i, 11) + Cells(v, 4), 10)
Exit For
End If
End If
Next
Next
Range(Cells(1, 8), Cells(Cells(Rows.Count, 12).End(xlUp).Row, 12)).Sort _
key1:=Range("K1"), order1:=xlAscending, dataoption1:=xlSortNormal, _
key2:=Range("L1"), order2:=xlAscending, dataoption2:=xlSortNormal, Header:=xlYes
End Sub