Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim NC_DC As Range
Dim Sh1 As Worksheet
Dim Sh2 As Worksheet
Set Sh1 = Sheets("BCommandes")
Set Sh2 = Sheets("Historiques")
Dim Fin As Long
Fin = Sh1.Range("B65536").End(xlUp).Row
Set NC_DC = Sh1.Range(Cells(Fin, 1), Cells(Fin, 2))
If Application.WorksheetFunction.CountA(NC_DC) = 2 Then
Sh2.Range("B" & Sh2.[B65536].End(xlUp).Row + 1) = NC_DC(2).Value
Else
MsgBox "Vous n'avez pas saisi de numéro de commande"
End If
End Sub