Sub Worksheet_Activate()
Dim DL%, i%, Lecr%
ActiveSheet.Unprotect ("SDIS") ' Déprotection
Application.ScreenUpdating = False
Range("A9:D" & Range("A65500").End(xlUp).Row - 1).ClearContents
Lecr = 9 ' Init pointeur écriture
With Sheets("SORTIE")
For i = 3 To .Range("A65500").End(xlUp).Row
If .Cells(i, "B") <> 0 Then ' Si quantité non nulle
Cells(Lecr, "A") = .Cells(i, "B") ' Qté
Cells(Lecr, "B") = .Cells(i, "A") ' Description
Cells(Lecr, "C") = .Cells(i, "D") ' PU
Cells(Lecr, "D") = .Cells(i, "E") ' PT
Lecr = Lecr + 1
Rows(Lecr).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove ' Insère ligne
End If
Next i
End With
DL = Range("A65500").End(xlUp).Row
Rows(Lecr + 1 & ":" & DL - 1).Delete Shift:=xlUp ' Supprime lignes inutiles
ActiveSheet.Protect "SDIS", True, True, , True ' Protection
End Sub