code VBA cho ban nao can:
Sub merge()
Dim i, j As Integer, tong As Double, lr As Integer
lr = Range("A65000").End(3).Row
For i = 1 To lr
For j = i To lr + 1
If Cells(j, 1) <> Cells(i, 1) Then
Range("B" & i & ":B" & j - 1).merge
Range("B" & i) = tong
tong = 0
i = j - 1
Exit For
End If
tong = tong + Cells(j, 1)
Next
Next
End Sub