Code VBA
Sophie
-
Sophie -
Sophie -
Bonjour,
Je souhaite appliquer un code VBA à mon graphique comme dans l'exercice suivant : http://astuces.xxxxxx.info/bureautique/excel-2007-creer-des-graphiques-qui-reagissent-a-vos-donnees.htm
J'utilise Excel 2010 mais voilà lorsque je rentre le code VBA, j'ai le message suivant :
erreur de compilation : attendu fin d'instruction.
Que dois-je faire ? Ou bien qu'ai-je fait de faux ?
Voici le code VBA :
Sub CouleurSeries()Dim MesSeries As SeriesWith ActiveChart
For Each MesSeries In .SeriesCollectionSelect Case MesSeries.Name
Case "astuces"MesSeries.Border.ColorIndex = 9MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 9MesSeries.MarkerForegroundColorIndex = 9MesSeries.MarkerSize = 10
Case "blog"MesSeries.Border.ColorIndex = 33MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 33MesSeries.MarkerForegroundColorIndex = 33MesSeries.MarkerSize = 10
Case "autres"MesSeries.Border.ColorIndex = 16MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 16MesSeries.MarkerForegroundColorIndex = 16MesSeries.MarkerSize = 10
Case "global"MesSeries.Border.ColorIndex = 46MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 46MesSeries.MarkerForegroundColorIndex = 46MesSeries.MarkerSize = 10End SelectNext
End WithEnd Sub
Merci d'avance pour vos réponses. Cordialement,
Sophie
Je souhaite appliquer un code VBA à mon graphique comme dans l'exercice suivant : http://astuces.xxxxxx.info/bureautique/excel-2007-creer-des-graphiques-qui-reagissent-a-vos-donnees.htm
J'utilise Excel 2010 mais voilà lorsque je rentre le code VBA, j'ai le message suivant :
erreur de compilation : attendu fin d'instruction.
Que dois-je faire ? Ou bien qu'ai-je fait de faux ?
Voici le code VBA :
Sub CouleurSeries()Dim MesSeries As SeriesWith ActiveChart
For Each MesSeries In .SeriesCollectionSelect Case MesSeries.Name
Case "astuces"MesSeries.Border.ColorIndex = 9MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 9MesSeries.MarkerForegroundColorIndex = 9MesSeries.MarkerSize = 10
Case "blog"MesSeries.Border.ColorIndex = 33MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 33MesSeries.MarkerForegroundColorIndex = 33MesSeries.MarkerSize = 10
Case "autres"MesSeries.Border.ColorIndex = 16MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 16MesSeries.MarkerForegroundColorIndex = 16MesSeries.MarkerSize = 10
Case "global"MesSeries.Border.ColorIndex = 46MesSeries.Border.Weight = xlThickMesSeries.MarkerStyle = xlMarkerStyleSquareMesSeries.MarkerBackgroundColorIndex = 46MesSeries.MarkerForegroundColorIndex = 46MesSeries.MarkerSize = 10End SelectNext
End WithEnd Sub
Merci d'avance pour vos réponses. Cordialement,
Sophie
3 réponses
-
Bonjour Sophie,
Essaye d'ajouter "End Select" avant ton "End With" et ça devrait fonctionner
si cela ne fonctionne pas je regarderais plus en détail ^^ -
LE SITE RECOMMANDE TELECHARGE LE MALWARE ADWARE.GEN7 DANS LE SETUP.EXE
-
Bonjour,
Je vous remercie de vos réponses. Je suis en train de refaire l'exercice mais ça ne marche toujours pas sur mon ordi. Il faut savoir que le code correspond à Excel 2007 alors que j'ai excel 2010. Je ne sais pas si c'est cela.
Le mot qui semble poser problème est le mot Dim au tout début ou les parenthèses. Sincèrement, je n'ai fait que copier et coller le code depuis le site jeanviet.info . Je ne sais même pas ce que ce code signifie.
Merci encore pour vos réponses (passées et futures),