
Sub somma_cruppi()
Dim righe, cell_a, cell_b, somma
somma = 0
righe = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To righe Step 1
cell_a = Cells(i, 1)
cell_b = Cells(i + 1, 1)
somma = somma + Cells(i, 2)
If cell_a <> cell_b Then
Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Value = cell_a
Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).Value = somma
somma = 0
End If
Next i
End Sub |
