A
Annbri
Guest
Bonsoir à tous et à toutes
J'utilise une macro trouvée sur ce forum à cette adresse:
<http://www.excel-downloads.com/html/French/forum/read.php?f=1&i=129944&t=129876>
pour dépasser la limite des 3 couleurs autorisées par la mise en forme conditionnelle. Je l'ai modifiée en fonction de mes besoins:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Select Case UCase(Target) 'UCASE = convertion de la frappe en majuscule'
Case "M9"
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Case "M26"
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Case "S1A"
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Case "M34"
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Case "N8"
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
Case "M34W"
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
Case "RHA"
With Selection.Interior
.ColorIndex = 38
.Pattern = xlSolid
End With
Case "RTT"
With Selection.Interior
.ColorIndex = 50
.Pattern = xlSolid
End With
Case "D"
With Selection.Interior
.ColorIndex = 43
.Pattern = xlSolid
End With
Case "CA"
With Selection.Interior
.ColorIndex = 28
.Pattern = xlSolid
End With
End Select
End Sub
Pour la mise en couleur des cellules en fonction de leur contenu tout fonctionne très bien mais dès que je sélectionne plus d'une cellule à la fois un message d'erreur est renvoyé:
"Erreur d'exécution '13'
Incompatibilité de type"
Où est l'erreur?
Le fichier joint vous permettra de mieux comprendre.
Merci d'avance à celui, celle ou ceux qui auront la gentillesse de venir à mon aide.
A bientôt
Annbri
J'utilise une macro trouvée sur ce forum à cette adresse:
<http://www.excel-downloads.com/html/French/forum/read.php?f=1&i=129944&t=129876>
pour dépasser la limite des 3 couleurs autorisées par la mise en forme conditionnelle. Je l'ai modifiée en fonction de mes besoins:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Select Case UCase(Target) 'UCASE = convertion de la frappe en majuscule'
Case "M9"
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Case "M26"
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
Case "S1A"
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Case "M34"
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
Case "N8"
With Selection.Interior
.ColorIndex = 39
.Pattern = xlSolid
End With
Case "M34W"
With Selection.Interior
.ColorIndex = 37
.Pattern = xlSolid
End With
Case "RHA"
With Selection.Interior
.ColorIndex = 38
.Pattern = xlSolid
End With
Case "RTT"
With Selection.Interior
.ColorIndex = 50
.Pattern = xlSolid
End With
Case "D"
With Selection.Interior
.ColorIndex = 43
.Pattern = xlSolid
End With
Case "CA"
With Selection.Interior
.ColorIndex = 28
.Pattern = xlSolid
End With
End Select
End Sub
Pour la mise en couleur des cellules en fonction de leur contenu tout fonctionne très bien mais dès que je sélectionne plus d'une cellule à la fois un message d'erreur est renvoyé:
"Erreur d'exécution '13'
Incompatibilité de type"
Où est l'erreur?
Le fichier joint vous permettra de mieux comprendre.
Merci d'avance à celui, celle ou ceux qui auront la gentillesse de venir à mon aide.
A bientôt
Annbri