[Macro] Sparkline en un clic

Hello,

Dans le cadre d'une installation d'un code raccourci clavier, j'ai besoin de créer une macro pour un graphique Sparkline

Voici le code auquel j'ai pensé, néanmoins j'ai une erreur qui s'affiche :

    Sub Spark()

    Dim v_Arguments As String
    Dim v_Selection As Range, v_Resultat As Range, c As Range

    Set cResultat = ActiveCell
    pColonne = False
    pLigne = False

    On Error Resume Next
    Set pSelection = Application.InputBox(Prompt:="Selectionnez/entrez une plage (ex. A1:D1)", _
    Title:="Spark", Type:=8)
    On Error GoTo 0

    Range("v_Resultat").SparklineGroups.Add Type:=xlSparkLine, SourceData:="v_Selection"
    Selection.SparklineGroups.Item(1).SeriesColor.Color = 9592887
    Selection.SparklineGroups.Item(1).SeriesColor.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Negative.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Negative.Color.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Markers.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Markers.Color.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Highpoint.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Highpoint.Color.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Lowpoint.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Lowpoint.Color.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Firstpoint.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Firstpoint.Color.TintAndShade = 0
    Selection.SparklineGroups.Item(1).Points.Lastpoint.Color.Color = 208
    Selection.SparklineGroups.Item(1).Points.Lastpoint.Color.TintAndShade = 0

    End Sub

Est-ce que quelqu'un peut m'éclairer,

Merci vous êtes au top

Naxos

Salut,

Compliqué sans fichier.

J'imagine que ton code plante à cet endroit ?

Range("v_Resultat").SparklineGroups.Add Type:=xlSparkLine, SourceData:="v_Selection"

Girodo,

Hello Girodo,

Effectivement ça plante à cet endroit, je ne sais pas exactement pourquoi ; as-tu une idée ?

Merci pour ton message

Naxos

Hello,

Quelqu’un a une idée ? Je m’en sors pas là dessus !!

Vous seriez au top !

Naxos

Rechercher des sujets similaires à "macro sparkline clic"