Bonjour,
Désolé de revenir sur un post vieux de deux ans, mais je viens de personnaliser à ma région un des deux exemples. Je n'ai aucune connaissance en VBA, hormis le Copier-Coller
Cela répond à mes attentes, sauf que la carte ne se met à jour que si j'encode chiffre par chiffre.
Comment modifier la formule
Option Explicit
Sub ColorieDepartement(CelMod As Range)
Dim Ligne As Long
Dim Couleur As Long
Dim Formes As Object
Ligne = CelMod.Row
With ThisWorkbook.Sheets(1)
Set Formes = .Shapes(.Cells(Ligne, 2))
With Formes
.Fill.Solid
.Fill.Transparency = 0#
.Fill.ForeColor.RGB = CouleurDep(ThisWorkbook.Sheets(1).Cells(Ligne, 3).Value)
With .TextFrame2.TextRange
.Characters.Text = ThisWorkbook.Sheets(1).Cells(Ligne, 3).Value
.Characters().Font.Size = 8
.Parent.VerticalAnchor = msoAnchorMiddle
.Parent.HorizontalAnchor = msoAnchorNone
End With
End With
End With
End Sub
Function CouleurDep(CelRef As Variant)
If CelRef = "" Or CelRef = 0 Then CouleurDep = 16777215
If CelRef >= Range("e36") And CelRef <= Range("g36") Then CouleurDep = 16777215
If CelRef >= Range("e37") And CelRef <= Range("g37") Then CouleurDep = 13209
If CelRef >= Range("E38") And CelRef <= Range("g38") Then CouleurDep = 255
If CelRef >= Range("E39") And CelRef <= Range("g39") Then CouleurDep = 39423
If CelRef >= Range("E40") And CelRef <= Range("g40") Then CouleurDep = 65535
If CelRef >= Range("E41") And CelRef <= Range("g41") Then CouleurDep = 52749
If CelRef >= Range("E42") And CelRef <= Range("g42") Then CouleurDep = 52377
If CelRef >= Range("E43") And CelRef <= Range("g43") Then CouleurDep = 26637
If CelRef >= Range("E44") Then CouleurDep = 16763904
End Function
Je joins la carte en question.
D'ores et déjà un tout grand merci de votre aide.
Philippe