renommer Shape VBA

C@thy

XLDnaute Barbatruc
Bonsoir,

j'ai une erreur dans le nom d'une shape, je n'arrive pas à renommer à la main, alors j'essaie en VBA

ActiveSheet.Shapes('Forme libree94').Name = ActiveSheet.Shapes('Forme libre 94') NE MARCHE PAS;

Pouvez-vous m'aider SVP????

Merci B)
 

C@thy

XLDnaute Barbatruc
Merci Michel de voler à mon secours aussi promptement (bip bip!!!)

1ère soluce : erreur d'exécution 70 permission refusée

non mais, de quoi y s'mêle!!!
2 ème soluce : impossible, rien à faire, y veut pas!

M'enfin!! Fait que me contrarier!!!

Mon fichier est trop gros pour être mis en PJ

j'ai une autre shape qui s'appelle 'Forme libre 920' au lieu de 'Forme libre 92', pareil!!!

Merci pour votre aide.

[file name=ShapeCathy.zip size=14510]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/ShapeCathy.zip[/file]
 

Pièces jointes

  • ShapeCathy.zip
    14.2 KB · Affichages: 134

MichelXld

XLDnaute Barbatruc
rebonsoir C@thy

chez moi il n'y a aucun soucis pour modifier manuellement le nom de la forme

modifies le texte dans la zone de nom puis utilises la touche 'Entree' pour valider


bonne soirée
MichelXld [file name=Shape CathyV02_20050321202149.zip size=13032]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/Shape CathyV02_20050321202149.zip[/file]
 

Pièces jointes

  • Shape CathyV02_20050321202149.zip
    12.7 KB · Affichages: 129

C@thy

XLDnaute Barbatruc
j'ai tout enlevé de ma carte de France et c'est passé,

ce que je veus fairs c'est quand je colorie les 3 petits départements verts sans inscription ça colorie aussi les grands en couleur fluo.
Alors je fais un test si forme libre 75000 ou
forme libre 92000 ou forme libre 93000 ou forme libre 93000
Ca marche pour le 75

Code:
For Dept = 1 To intNbDepartement
Sheets('Carte').Select
       ActiveSheet.Shapes(strNameCellGraph).Select
       fixerCouleur R, G, B '(sous-routine)
       If strNameCellGraph = 'Forme libre 75000' Or strNameCellGraph = 'Forme libre 91000' Or strNameCellGraph = 'Forme libre 92000' Or strNameCellGraph = 'Forme libre 91000' Then
    toto = Mid(strNameCellGraph, 13, 2)
    strNameCellGraph = 'Forme libre ' & toto
    ActiveSheet.Shapes(strNameCellGraph).Select
    fixerCouleur R, G, B
    End If
    Next
.....
Code:
Private Sub fixerCouleur(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer)
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(R, G, B)
    Selection.ShapeRange.Fill.Visible = msoTrue
    
End Sub

si code pas terrible, recherche meilleur!!!

Merci pour tout (y compris votre grande indulgence!!!).

C@thy
 

C@thy

XLDnaute Barbatruc
Ah merci, ça c'est SUPER!!!
Tu pourrais faire pareil avec le 94 (remplacer le 2ème e par espace???)
ce serait vraiment gentil, car j'y arrive pas du tout, quand je valide il remet ce qu'il y avai avant, et toi, tu fais ça tout seul!!! C pas juste!!!

Merci Michel :kiss:
 

MichelXld

XLDnaute Barbatruc
rebonsoir C@thy

ci joint le fichier modifié pour le 94

tu es sur que tu n'as pas ouvert ton classeur avec Open Office ?...;o)


bonne soiree
MichelXld [file name=ShapeCathyV02.zip size=13027]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/ShapeCathyV02.zip[/file]
 

Pièces jointes

  • ShapeCathyV02.zip
    12.7 KB · Affichages: 95

C@thy

XLDnaute Barbatruc
Moarf!!!! MDR!!!
SmileyMDR.gif


Ben figure-toi, ça marche pour le 75, le 92 (grâce à ton renommage),
... et pis c'est tout!!!

Je joins mon fichier au cas où tu aurais un peu de temps pour regarder. J'suis encore au boulot, mais fô que j'm'en va à ma maison.

Biz et merci

C@tjh [file name=ShapeCathy_20050321211618.zip size=14510]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/ShapeCathy_20050321211618.zip[/file]
 

Pièces jointes

  • ShapeCathy_20050321211618.zip
    14.2 KB · Affichages: 65

C@thy

XLDnaute Barbatruc
Désolée, G pas joint le bon...
le voici

Biz et merci. [file name=ShapeCathy_20050321212704.zip size=17929]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/ShapeCathy_20050321212704.zip[/file]
 

Pièces jointes

  • ShapeCathy_20050321212704.zip
    17.5 KB · Affichages: 65

C@thy

XLDnaute Barbatruc
G validé trop vite!!!

Merci aux pros qui veulent bien se pencher sur mon cas (qui n'est pas désespéré!!!) [file name=ShapeCathy_20050321213654.zip size=17929]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/ShapeCathy_20050321213654.zip[/file]
 

Pièces jointes

  • ShapeCathy_20050321213654.zip
    17.5 KB · Affichages: 91

C@thy

XLDnaute Barbatruc
Ah ben j'ai trouvé, c'était tout simple mais quand on cherche trop on ne trouve pas, c'est pourquoi j'avais besoin d'un oeil neuf
j'ai remplacé
If strNameCellGraph = 'Forme libre 75000' Or strNameCellGraph = 'Forme libre 91000' Or strNameCellGraph = 'Forme libre 92000' Or strNameCellGraph = 'Forme libre 91000' Then
par
If strNameCellGraph = 'Forme libre 75000' Or strNameCellGraph = 'Forme libre 92000' Or strNameCellGraph = 'Forme libre 93000' Or strNameCellGraph = 'Forme libre 94000' Then
c'est tout, et ça marche nickel.

Merci à Michel qui a passé du temps sur mon pb. ;)
 

Discussions similaires

Réponses
2
Affichages
145

Statistiques des forums

Discussions
312 047
Messages
2 084 864
Membres
102 690
dernier inscrit
souleymaane