Sub Sauvegarde()
Dim F1 As String
Dim F2 As String
F1 = Sheets("Bdd").Name
F2 = Sheets("Sauvegarde").Name
' Sheets(F2).Select
On Error Resume Next
li = Sheets(F1).Cells(36000, 2).End(xlUp).Row
ligne = Sheets(F2).Cells(36000, 2).End(xlUp).Row + 1
For i = 3 To li
If Sheets(F1).Cells(i, 14).Value < Date - 30 Then
Sheets(F2).Cells(ligne, 9) = Sheets(F1).Cells(i, 16)
Sheets(F2).Cells(ligne, 1) = Sheets(F1).Cells(i, 1)
Sheets(F2).Cells(ligne, 2) = Sheets(F1).Cells(i, 2)
Sheets(F2).Cells(ligne, 3) = Sheets(F1).Cells(i, 3)
Sheets(F2).Cells(ligne, 4) = Sheets(F1).Cells(i, 4)
Sheets(F2).Cells(ligne, 5) = Sheets(F1).Cells(i, 5)
Sheets(F2).Cells(ligne, 6) = Sheets(F1).Cells(i, 6)
Sheets(F2).Cells(ligne, 7) = Sheets(F1).Cells(i, 7)
Sheets(F2).Cells(ligne, 8) = Sheets(F1).Cells(i, 8)
ligne = ligne + 1
End If
Next i
Sheets(F1).Select
Call suppLig
MsgBox "sauvegarde effectuée, tableau mis à jour"
End Sub
Sub suppLig()
Dim F1 As String
F1 = Sheets("Bdd").Name
Sheets(F1).Unprotect
Dim lig As Long
For lig = Sheets(F1).Cells(36000, 2).End(xlUp).Row To 3 Step -1
If Sheets(F1).Cells(lig, 14).Value < Date - 30 Then Rows(lig).EntireRow.Delete
Next lig
Sheets(F1).Protect
End Sub