maguetlolo
XLDnaute Junior
Bonjour tout le monde
Voila, je modifie toute une macro sortie de l'enregistreur, mais la, apres avoir supprimé ou modifié pas mal de chose, je butte un peu.
si vous pouvez me conseillez concernant ce morceau?
	
		
merci pour vos réponse
	
		
			
		
		
	
				
			Voila, je modifie toute une macro sortie de l'enregistreur, mais la, apres avoir supprimé ou modifié pas mal de chose, je butte un peu.
si vous pouvez me conseillez concernant ce morceau?
		Code:
	
	
	Sheets("TK2").Select
    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
    "$A1:$D1000").CreatePivotTable TableDestination:="", TableName:="Tableau croisé dynamique7", DefaultVersion:=xlPivotTableVersion10
        With ActiveSheet.PivotTables("Tableau croisé dynamique7").PivotFields("TK")
    .Orientation = xlPageField
    .Position = 1
    ActiveSheet.PivotTables("Tableau croisé dynamique7").AddDataField ActiveSheet. _
        PivotTables("Tableau croisé dynamique7").PivotFields("Défaut"), _
        "Nombre de Défaut", xlCount
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique7").PivotFields("Défaut")
        .Orientation = xlColumnField
        .Position = 1
    End With
    With ActiveSheet.PivotTables("Tableau croisé dynamique7").PivotFields("Défaut")
        .Orientation = xlRowField
        .Position = 1
            End With
    ActiveSheet.Name = "R02"
    
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("R02").Range("$A1:$B100")
    ActiveChart.Location Where:=xlLocationAsObject, Name:= _
    "Graphiques défauts TK"
    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.Text = "Nombre de défauts TK2"
        .Axes(xlCategory, xlPrimary).HasTitle = False
        .Axes(xlValue, xlPrimary).HasTitle = False
            ActiveChart.ChartArea.Select
     ActiveChart.HasPivotFields = False
     ActiveChart.Legend.Select
    Selection.Delete
     ActiveChart.SeriesCollection(1).Select
    ActiveChart.ChartArea.Select
    ActiveChart.ApplyDataLabels AutoText:=True, LegendKey:=False, _
        HasLeaderLines:=False, ShowSeriesName:=False, ShowCategoryName:=False, _
        ShowValue:=True, ShowPercentage:=False, ShowBubbleSize:=False
    ActiveSheet.Shapes("Graphique 2").IncrementLeft -226.5
    ActiveSheet.Shapes("Graphique 2").IncrementTop -89.25
    End With
       
    ActiveChart.PlotArea.Select
    With Selection.Border
        .ColorIndex = 2
        .Weight = xlThin
        .LineStyle = xlContinuous
    End With
    With Selection.Interior
        .ColorIndex = 2
        .PatternColorIndex = 1
        .Pattern = xlSolid
    End With
    ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MinimumScaleIsAuto = True
        .MaximumScale = 120
        .MinorUnitIsAuto = True
        .MajorUnit = 20
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
        
        
    With ActiveSheet.Shapes("Graphique 2")
    .Left = Range("a27").Left
    .Top = Range("A27").Top
	merci pour vos réponse