Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Code Simplifié

12 réponses
Avatar
Guy72
Bonsoir,
Peut-on simplifier ce code ?

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Count > 1 Or Intersect(Target, Range("D4")) Is Nothing Then Exit
Sub
If Target = "Guy" Then
Range(Cells(Target.Row, 4), Cells(Target.Row,
4)).Interior.ColorIndex = 16
Range(Cells(Target.Row, 4), Cells(Target.Row, 4)).Font.ColorIndex =
16
Exit Sub
End If

Fin:
End Sub

Merci de votre aide
--
Cordialement
Guy

2 réponses

1 2
Avatar
LSteph
..celui-ci fonctionne:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Not Intersect(Target, [d4]) Is Nothing Then
With [d4]
.Interior.ColorIndex = IIf(UCase(.Value) = "GUY", 16, xlNone)
.Font.ColorIndex = IIf(UCase(.Value) = "GUY", 16, xlAutomatic)
End With
End If
End Sub


Fredo P a écrit :
Roh!! Les monstres comme disait mon Gd_père
"Modeste" a écrit dans le message de news:

Bonsour® Fredo P avec ferveur ;o))) vous nous disiez :


With Target
.Interior.ColorIndex = IIf(.Value="Guy",16, xlNone)
.Font.ColorIndex = IIf(.Value="Guy",16, xlNone)
End With



Avatar
Fredo P
"LSteph" a écrit dans le message de news:
%
la fils c'est rho..ger la fille rha..maya

;o)


Elle bonne celle la!!
OO))
1 2