Private Sub Worksheet_change(ByVal Target As Range)
Dr1 = 10
If [G3] = "Amb" Then Flag = False Else Flag = True
For n = 1 To 5: ActiveSheet.Shapes("Rectangle " & n).Visible = Flag: Next n
For n = 1 To 3: ActiveSheet.Shapes("Rectangle " & n + Dr1).Visible = Not (Flag): Next n
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, [G3]) Is Nothing Then
Dr1 = 10
If Target = "Amb" Then Flag = False Else Flag = True
For n = 1 To 5: ActiveSheet.Shapes("Rectangle " & n).Visible = Flag: Next n
For n = 1 To 3: ActiveSheet.Shapes("Rectangle " & n + Dr1).Visible = Not (Flag): Next n
If Target = "Amb" Then Target = "Fixe" Else Target = "Amb"
Range(Target.Address).Offset(1, 0).Select
End If
End Sub
For n = 1 To Dr2
ActiveSheet.Shapes("Rectangle " & n + Dr1).visible = Not (Flag)
For lgPar = 2 To Dr2
'MsgBox Par.Cells(lgPar, 27) ' & " / " & ActiveSheet.Shapes("Rectangle " & n + Dr1)
' j'ai essayé avec .Text ou encore .Caption
If Par.Cells(lgPar, 27) = ActiveSheet.Shapes("Rectangle " & n + Dr1) Then 'GLUPSS !!!
ActiveSheet.Shapes("Rectangle " & n + Dr1).Interior.Color = Par.Cells(lgPar, 27).Interior.Color
ActiveSheet.Shapes("Rectangle " & n + Dr1).Font.Color.Index = Par.Cells(lgPar, 27).Font.Color.Index
End If
Next lgPar
Next n
.Fill.ForeColor.RGB pour le fond
.Line.ForeColor.RGB pour les bordures
.Line.Weight = X
Couleur = Target.Interior.Color
' For n = 1 To Dr1: ActiveSheet.Shapes("Rectangle " & n).Fill.ForeColor.RGB = Couleur: Next n
For n = 1 To Dr2
Couleur = Par.Range("AA" & n).Interior.Color
If Par.Range("AA" & n) = ActiveSheet.Shapes("Rectangle " & n + Dr1).Fill Then
ActiveSheet.Shapes("Rectangle " & n + Dr1).Fill.ForeColor.RGB = Par.Range("AA" & n).Couleur
End If
Next n
Est une adresse de cellulePar.Range("AA" & n)
Est une action : Remplir.ActiveSheet.Shapes("Rectangle " & n + Dr1).Fill