Private Sub Worksheet_Activate()
Dim lig&
Application.ScreenUpdating = False
Cells.Delete 'RAZ
Sheets("Fichier Brut").[C18].CurrentRegion.EntireRow.Copy [A1] 'à adapter
With [C1].CurrentRegion.EntireRow
.Sort .Columns(10), xlAscending, Header:=xlYes 'tri sur la colonne J
For lig = .Rows.Count To 2 Step -1
If .Cells(lig, 10) <> Cells(lig - 1, 10) Then
.Rows(lig).Resize(3).Insert 'insère 3 lignes
With .Rows(lig + 1)
.Cells(1, 3) = .Cells(3, 10)
.Cells(1, 3).Font.Bold = True 'gras
.Borders(xlEdgeTop).Weight = xlThin
.Borders(xlEdgeBottom).Weight = xlMedium
End With
End If
Next
.Rows(1).RowHeight = 24.75 'hauteur
.Rows(1).Interior.ColorIndex = 15 'gris
.Rows(1).Font.Bold = True 'gras
.Columns.AutoFit 'ajustement largeurs
End With
With UsedRange: End With 'actualise les barres de défilement
End Sub