Bonjour et bonne année,
Copie ce code, dans ton vrai classeur. Les modifications apportées sont surlignées.
A te relire.
Cdlt.
Option Explicit
'Option Private Module
Public Sub Onglets_consolider()
Dim ws As Worksheet, wsTotal As Worksheet
Dim lo As ListObject
Dim lRow As Long
Application.ScreenUpdating = False
Set wsTotal = Worksheets("Total")
With wsTotal
Set lo = .ListObjects(1)
If Not lo.DataBodyRange Is Nothing Then lo.DataBodyRange.Delete
End With
lRow = 2
For Each ws In Worksheets(Array("CA-courant", "CE-courant ", "CA-carte", "Especes"))
Set lo = ws.ListObjects(1)
lo.DataBodyRange.Offset(1, 0).Resize(lo.ListRows.Count - 1, lo.ListColumns.Count - 1).Copy
With wsTotal
.Cells(lRow, 1).PasteSpecial xlPasteValues
lRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
End With
Application.CutCopyMode = False
Next ws
With wsTotal
.PivotTables(1).PivotCache.Refresh
.ListObjects(1).ShowAutoFilter = False
.Cells(lRow - 1, 9).Select
MsgBox ActiveCell
End With
Set lo = Nothing
Set wsTotal = Nothing
End Sub