Private Sub Worksheet_Change(ByVal Target As Range)
Dim P As Range, maxi&
With [B3].CurrentRegion.EntireRow
If Application.CountIf(.Columns(43), "Oui") = 0 Then Exit Sub
Application.EnableEvents = False 'désactive les évènements
.Columns(44) = "=1/(RC[-1]<>""Oui"")" 'colonne AR auxiliaire
.Cells(1, 44) = ""
.Columns(44) = .Columns(44).Value 'supprime les formules
.Sort .Columns(44), Header:=xlYes 'tri pour accélérer
Set P = .Columns(44).SpecialCells(xlCellTypeConstants, 16).EntireRow
With Feuil2 'CodeName de la feuille Facturation
maxi = Application.Max(.Columns(3)) 'dernier numéro de facture
P.Copy 'copier
.Cells(Application.Match("zzz", .Columns(2)) + 1, 1).Insert 'insertion des lignes copiées
P.Delete
With .Columns(44).SpecialCells(xlCellTypeConstants, 16).EntireRow
.Columns(2) = "FAC"
.Cells(1, 3) = maxi + 1
.Columns(3).DataSeries 'numérotation
.Columns(42).Resize(, 3).Delete xlToLeft
End With
'.Activate 'facultatif
End With
.Columns(44).ClearContents 'RAZ de la colonne auxiliaire
Application.EnableEvents = True 'réactive les évènements
End With
End Sub