Sub Archivage()
Dim dWKS As Worksheet, SRC_Rng As Range, Dest_Rng As Range
Application.ScreenUpdating = False
Select Case InStr(ThisWorkbook.Name, "BU")
Case Is > 0
Set dWKS = Workbooks("BUDATA_VIR.xlsx").Sheets("BU_PI")
Case Else
Set dWKS = Workbooks("BUDATA_VIR.xlsx").Sheets("B_PV")
End Select
Set Dest_Rng = dWKS.Cells(Rows.Count, 1).End(xlUp)(2)
'Copie du contenu de data
With Sheets("Data")
Set SRC_Rng = .Cells(2, 1).Resize(.Cells(Rows.Count, "A").End(xlUp).Row - 1, 7)
SRC_Rng.Copy: Dest_Rng.PasteSpecial -4163
Application.CutCopyMode = False: .[A2].Select
End With
'inscrire la date de la copie
Dest_Rng.Offset(, 7) = Date
'enregistrement et fermeture du fichier d'archivage
Workbooks("BUDATA_VIR.xlsx").Close True
Application.ScreenUpdating = True
End Sub