Option Explicit
Sub Centralisation()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets("Centralisation").Delete
Application.DisplayAlerts = True
Sheets.Add
ActiveSheet.Name = "Centralisation"
Sheets("Entrée sortie").Rows("1:1").Copy Sheets("Centralisation").Range("A1")
Sheets("Centralisation").Move After:=Sheets(Sheets.Count)
Sheets("Entrée sortie").Activate
Sheets("Entrée sortie").Range("A2:Z" & Range("A" & Sheets("Entrée sortie").Rows.Count).End(xlUp).Row).Copy
Sheets("Centralisation").Activate
Range("A" & Sheets("Centralisation").Range("A" & Rows.Count).End(xlUp).Row + 1).Select
ActiveSheet.Paste
Sheets("stock final").Activate
Sheets("stock final").Range("A2:Z" & Range("A" & Sheets("stock final").Rows.Count).End(xlUp).Row).Copy
Sheets("Centralisation").Activate
Range("A" & Sheets("Centralisation").Range("A" & Rows.Count).End(xlUp).Row + 1).Select
ActiveSheet.Paste
Sheets("Etat intermédiaire").Activate
Sheets("Etat intermédiaire").Range("A2:Z" & Range("A" & Sheets("Etat intermédiaire").Rows.Count).End(xlUp).Row).Copy
Sheets("Centralisation").Activate
Range("A" & Sheets("Centralisation").Range("A" & Rows.Count).End(xlUp).Row + 1).Select
ActiveSheet.Paste
Cells.EntireColumn.AutoFit
With ActiveWorkbook.Worksheets("Centralisation").Sort
.SortFields.Clear
.SortFields.Add Key:=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending
.SetRange Range("A2:O5000")
.Header = xlNo
.Apply
End With
Range("A1").Select
ActiveSheet.Range("$A$1:$O$311").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, _
7, 8, 9, 10, 11, 12, 13, 14, 15), Header:=xlYes
ActiveWorkbook.Names("Base_TCD").RefersToR1C1 = _
"=OFFSET(Centralisation!C1:C26,,,COUNTA(Centralisation!C1),COUNTA(Centralisation!R1C1:R1C26))"
Application.ScreenUpdating = True
End Sub