Problème avec un code d'une feuille.
En fait c'est un code qui doit remplir de conditions, selon ou le double clic est effectué.
Ce code permet de colorer par un double clic en vert et par deux en rouge la cellule concerné, l'autre
Erreur d'execution '9',
L'indice n'appartient pas à la selection/Débogage :
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim c As Long, i As Long
Cancel = True
If Not Application.Intersect(Target, [E3:J10]) Is Nothing Then Target.Interior.ColorIndex = IIf(Target.Interior.ColorIndex = 4, xlNone, 4)
If Target.Column = 4 Then
Cells(Target.Row, 4) = Date
End If
If Target.Column = 11 Then
Cells(Target.Row, 11) = Date
End If
If Intersect(Target, Range("Designat")) Is Nothing Then Exit Sub
c = Target.Interior.ColorIndex
For i = 1 To Range("PLR").Count
If Range("PLR").Cells(i, 1).Interior.ColorIndex = c Then
Target.Interior.ColorIndex = Range("PLR").Cells(i + 1, 1).Interior.ColorIndex
Target.Font.ColorIndex = Range("PLR").Cells(i + 1, 1).Font.ColorIndex
i = Range("PLR").Count
Cancel = True
End If
Next i
End Sub
La ligne en rouge est en réalité en fond jaune.
Merci par avance à ceux qui ont une idée de cette erreur et qui me la transmettrons.
https://www.excel-pratique.com/~files/doc2/PalESD3E.xls