1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub FusionCellules()
Dim i As Long, j As Long, h As Long, k As Long
Application.DisplayAlerts = False
For i = 1 To Range("B65536").End(xlUp).Row - 1 'étude colonne A
j = i + 1
While Cells(j, 1) = Cells(i, 1)
Range(Cells(i, 1), Cells(j, 1)).MergeCells = True
j = j + 1
Wend
For h = i To j - 2 'étude colonne C
k = h + 1
While Cells(k, 3) = Cells(h, 3) And k < j
Range(Cells(h, 3), Cells(k, 3)).MergeCells = True
k = k + 1
Wend
h = k - 1
Next h
i = j - 1
Next i
Application.DisplayAlerts = True
End Sub |
Partager