re
Je comprends à 50% ton explication, ce qui est tout à fait logique...
Dans toutes mes lignes de codes, où dois-je placer
for each shap in shapes(nomdugroup).GroupItems
'là oui tu va lister les depts
next
Mon code pour la carte Groupe 2 qui est lié au bouton PAC5...je ne vois pas où placer ta ligne ? dans Sub ListShapes() ...
Sub EcritNoDepart()
For Each c In [départ]
If c <> "" Then ecritShape "fr-" & c, c.Offset(, 2) & Chr(10) & c
Next c
c = "54": ecritShape "fr-" & c, "Meurthe-" & Chr(10) & "Moselle", "Bas"
c = "90": ecritShape "fr-" & c, "TB"
c = "192": ecritShape "fr-" & c, "Hauts-Seine", , "Gauche"
c = "175": ecritShape "fr-" & c, "Paris"
c = "193": ecritShape "fr-" & c, "Seine-st-Denis"
c = "194": ecritShape "fr-" & c, "Val de Marne"
End Sub
--------
Sub coloriage2()
'PAC5
For Each c In [départ]
If c <> "" Then
ca = c.Offset(, 2)
p = Application.Match(ca, [légende], 0)
If Not IsError(p) Then
couleur = Range("légende").Cells(p, 1).Interior.Color
ActiveSheet.Shapes("fr-" & c).Fill.ForeColor.RGB = couleur
End If
End If
Next c
End Sub
----------
Sub ecritShape(nomShape, Libellé, Optional posVert, Optional posHoriz)
Application.Volatile
With ActiveSheet.Shapes(nomShape).TextFrame2.TextRange
.Characters.Text = Libellé
.Characters.Font.Size = 6
If IsMissing(posVert) Then
.Parent.VerticalAnchor = msoAnchorMiddle
Else
If posVert = "Bas" Then
.Parent.VerticalAnchor = msoAnchorBottom
Else
.Parent.VerticalAnchor = msoAnchorMiddle
End If
End If
If IsMissing(posHoriz) Then
.Parent.HorizontalAnchor = msoAnchorCenter
Else
If posHoriz = "Gauche" Then
.Parent.HorizontalAnchor = msoAnchorNone
Else
.Parent.HorizontalAnchor = msoAnchorCenter
End If
End If
End With
End Sub
-----------
Sub bulles2()
For Each s In ActiveSheet.Shapes
If s.Type <> 8 Then
ActiveSheet.Hyperlinks.Add Anchor:=s, Address:="", SubAddress:=""
tmp = Mid(s.Name, 2)
bulle = Application.VLookup(tmp, [departca], 2, False)
If Not IsError(bulle) Then
libdep = Application.VLookup(tmp, [departca], 3, False)
s.Hyperlink.ScreenTip = libdep & " Ca:" & Format(bulle, "# ##0") & Chr(10)
Else
s.Hyperlink.ScreenTip = "...."
End If
End If
Next s
End Sub
----------
Sub auto()
Application.Calculation = xlAutomatic
End Sub
----------
Sub manuel()
Application.Calculation = xlManual
End Sub
----------
Sub majPAC5()
coloriage2
bulles2
End Sub
----------
Sub ListShapes()
i = 2
For Each s In ActiveSheet.Shapes
Cells(i, "u") = s.Name
i = i + 1
Next s
End Sub
Merci pour vos lumières ...