' Création des Tableau Croisé dynamique
Sub TCD()
Dim PlageMag As Range
Dim Oper As Single
Dim CptM As Integer
Dim ChxMag As String
Dim J As Integer
Dim Mag As String
Workbooks(FicRec).Activate
Workbooks(FicRec).Sheets(SheetCompilation).Select
Range(Cells(1, 1), Cells(NbligFicMagasin, 8)).Name = "Base_TCD"
Windows(FicRec).Activate
ActiveWorkbook.Queries.Add Name:="T_Compilation", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Excel.CurrentWorkbook(){[Name=""Base_TCD""]}[Content]," & Chr(13) & "" & Chr(10) & " #""En-têtes promus"" #""En-têtes promus"" #""Type modifié"" = Table.TransformColumnTypes(Source,{{""Magasin Commercial"", type text}, {""Libellé Produit"", type text}, {""Code vente (EAN)"", Int64.Type}, {""Fournisseur"", type text}, {""Date"", type date}, {""Quantité Vendue"", Int64.Type}, {""Montant HT"", type number}, {""Périod" & _
"e"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Type modifié"""