Sub Click()
Dim NomShape As String
Application.ScreenUpdating = False
Shapes("Roya").Fill.ForeColor.RGB = RGB(192, 255, 159)
Shapes("Vallee de la Vesubie").Fill.ForeColor.RGB = RGB(162, 236, 130)
Shapes("Vallee de la Tinee").Fill.ForeColor.RGB = RGB(135, 222, 135)
Shapes("Vallee du Var").Fill.ForeColor.RGB = RGB(170, 255, 204)
Shapes("Vallee de l'Esteron").Fill.ForeColor.RGB = RGB(188, 226, 162)
Shapes("Prealpes").Fill.ForeColor.RGB = RGB(195, 232, 146)
Shapes("Pays Grassois").Fill.ForeColor.RGB = RGB(230, 185, 184)
Shapes("Pays Niçois").Fill.ForeColor.RGB = RGB(242, 220, 219)
Shapes("Pays des Paillons").Fill.ForeColor.RGB = RGB(195, 214, 155)
Shapes("Pays Vençois").Fill.ForeColor.RGB = RGB(217, 150, 148)
Shapes("Grand Antibes").Fill.ForeColor.RGB = RGB(179, 162, 199)
Shapes("Grand Menton").Fill.ForeColor.RGB = RGB(243, 255, 159)
Shapes("Grand Beausoleil").Fill.ForeColor.RGB = RGB(255, 217, 159)
Shapes("Nice").Fill.ForeColor.RGB = RGB(204, 193, 218)
Shapes("Villeneuve Loubet").Fill.ForeColor.RGB = RGB(204, 193, 218)
Shapes("Cagnes").Fill.ForeColor.RGB = RGB(179, 162, 199)
Shapes("Grand Cannes").Fill.ForeColor.RGB = RGB(96, 74, 123)
Shapes("Mandelieu La Napoule").Fill.ForeColor.RGB = RGB(144, 224, 188)
Shapes("Valbonne").Fill.ForeColor.RGB = RGB(195, 214, 155)
NomShape = Application.Caller
'For Each Shape In ActiveSheet.Shapes
'Shape.Fill.ForeColor.RGB = RGB(255, 0, 255)
'Next Shape
Shapes(NomShape).Fill.ForeColor.RGB = RGB(255, 0, 0)
Range("U7:AE40").ClearContents
Range("AA44:AA48").ClearContents
Range("Y4") = NomShape
Range("AA7") = Application.Index(Sheets("BD Villes").Range("J2:L178"), Application.Match(NomShape, Sheets("BD Villes").Range("J2:J178"), 0), 3)
If Range("U5") = "Prospect" Then
MEF_Prospect
ElseIf Range("U5") = "Clients" Then
MEF_Clients
Else: MEF_Vide
End If
Range("AA44") = NomShape
TabInf
If Intersect(Target, [Y4]) Is Nothing Then Exit Sub
Dim cible$, col%, ncol%, t, a(), i&, n&, j%
cible = CStr([Y4])
col = 7 'colonne où se fait la recherche de cible
ncol = 11 'nombre de colonnes à copier >= col
t = Sheets("Clients").[A1].CurrentRegion.Resize(, ncol + 1)
ReDim a(1 To UBound(t), 1 To ncol)
For i = 2 To UBound(t)
If t(i, col) = cible Then
n = n + 1
For j = 1 To ncol
a(n, j) = t(i, j)
Next j
End If
Next i
'---restitution et mise en forme---
Application.ScreenUpdating = False
With [U7] '1ère cellule, à adapter
.Resize(Rows.Count - .Row + 1, ncol).Delete xlUp 'RAZ
End With
If n Then
With [U7].Resize(n, ncol)
.Value = a
.Interior.ColorIndex = 37 'bleu
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlInsideVertical).Weight = xlThin
End With
End If
Columns.AutoFit 'ajustement largeur
Application.ScreenUpdating = True
End Sub