MACRO EXCEL - création TCD
Résolu/Fermé
A voir également:
- MACRO EXCEL - création TCD
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Tcd excel - Guide
- Liste déroulante excel - Guide
- Si et excel - Guide
- Creation compte gmail - Guide
1 réponse
J'ai trouvé la solution, voici mon code modifié :
Sub tcd()
Dim q
Dim source As String
Dim nom As String
For q = 1 To 7 Step 1
source = "Q" & q & "!R3C1:R1021C258"
nom = "Q" & q & "TCD"
Sheets("Q" & q).Activate
Sheets("Q" & q).Range("A3").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Sheets.Add.Name = "Q" & q & "TCD"
ActiveSheet.Range("A3").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
source).CreatePivotTable TableDestination:=Selection, TableName:=nom
Next q
End Sub
Sub tcd()
Dim q
Dim source As String
Dim nom As String
For q = 1 To 7 Step 1
source = "Q" & q & "!R3C1:R1021C258"
nom = "Q" & q & "TCD"
Sheets("Q" & q).Activate
Sheets("Q" & q).Range("A3").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Sheets.Add.Name = "Q" & q & "TCD"
ActiveSheet.Range("A3").Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
source).CreatePivotTable TableDestination:=Selection, TableName:=nom
Next q
End Sub