Créer une nouvelle feuille si appuis du bouton

Bonjour à tous,

je viens de créer une macro qui fonctionne bien mais pas comme je souhaite !!

Pour le moment ma macro affiche le graphe dans la même feuille que les données et c'est pas ce que je veux.

Je veux que lorsqu'on appuis sur le bouton, la macro créer une nouvelle page pour afficher le graphe tout simplement si possible.

Ci joint la macro.

Je vous remercie d'avance madame et monsieur.

cordialement.

32excel-macrobis.xlsm (275.67 Ko)

Bonjour

Plutôt que la macro, une fois sur ta feuille clique dans une cellule puis appuie sur la touche F11 ou ALT + F11 de ton clavier (Veille à ce que toutes tes colonnes aient un titre)

Crdlt

bonjour,

une proposition de correction de ta macro

Sub graphhistogramme()
'
' graphhistogramme Macro
'

'
    Range("C:C,A:A").Select
    Range("A1").Activate
    ActiveSheet.Shapes.AddChart(332, xlLineMarkers).Select
    ActiveChart.SetSourceData Source:=Range( _
        "Macro_prog_mircocoupure!$C:$C,Macro_prog_mircocoupure!$A:$A")
        ActiveChart.SetElement (msoElementChartTitleCenteredOverlay)
    ActiveChart.ChartTitle.Select
    ActiveChart.ChartTitle.Text = "Integrité de temps"
    Selection.Format.TextFrame2.TextRange.Characters.Text = "Integrité de temps"
    With Selection.Format.TextFrame2.TextRange.Characters(1, 18).ParagraphFormat
        .TextDirection = msoTextDirectionLeftToRight
        .Alignment = msoAlignCenter
    End With
    With Selection.Format.TextFrame2.TextRange.Characters(1, 9).Font
        .BaselineOffset = 0
        .Bold = msoTrue
        .NameComplexScript = "+mn-cs"
        .NameFarEast = "+mn-ea"
        .Shadow.Type = msoShadow22
        .Shadow.Visible = msoTrue
        .Shadow.Style = msoShadowStyleOuterShadow
        .Shadow.Blur = 4
        .Shadow.OffsetX = 1.8369701987E-16
        .Shadow.OffsetY = 3
        .Shadow.RotateWithShape = msoFalse
        .Shadow.ForeColor.RGB = RGB(0, 0, 0)
        .Shadow.Transparency = 0.599999994
        .Shadow.Size = 100
        .Fill.Visible = msoTrue
        .Fill.ForeColor.RGB = RGB(242, 242, 242)
        .Fill.Transparency = 0
        .Fill.Solid
        .Size = 16
        .Italic = msoFalse
        .Kerning = 12
        .Name = "+mn-lt"
        .UnderlineStyle = msoNoUnderline
        .Spacing = 1
        .Strike = msoNoStrike
    End With
    With Selection.Format.TextFrame2.TextRange.Characters(10, 9).Font
        .BaselineOffset = 0
        .Bold = msoTrue
        .NameComplexScript = "+mn-cs"
        .NameFarEast = "+mn-ea"
        .Shadow.Type = msoShadow22
        .Shadow.Visible = msoTrue
        .Shadow.Style = msoShadowStyleOuterShadow
        .Shadow.Blur = 4
        .Shadow.OffsetX = 1.8369701987E-16
        .Shadow.OffsetY = 3
        .Shadow.RotateWithShape = msoFalse
        .Shadow.ForeColor.RGB = RGB(0, 0, 0)
        .Shadow.Transparency = 0.599999994
        .Shadow.Size = 100
        .Fill.Visible = msoTrue
        .Fill.ForeColor.RGB = RGB(242, 242, 242)
        .Fill.Transparency = 0
        .Fill.Solid
        .Size = 16
        .Italic = msoFalse
        .Kerning = 12
        .Name = "+mn-lt"
        .UnderlineStyle = msoNoUnderline
        .Spacing = 1
        .Strike = msoNoStrike
    End With
    ActiveChart.ChartArea.Select
    'ActiveSheet.Shapes("Graphique 3").IncrementLeft -21
    'ActiveSheet.Shapes("Graphique 3").IncrementTop -3
     ActiveChart.Location Where:=xlLocationAsNewSheet
    'Range("G7").Select
End Sub
Rechercher des sujets similaires à "creer nouvelle feuille appuis bouton"