Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
Application.EnableEvents =
False
Dim
strZelle
As
String
With
Target
If
.Row > 500
Then
Exit
Sub
If
.Row < 8
Then
Exit
Sub
If
.Column > 4
Then
Exit
Sub
End
With
Select
Case
Target.Column
Case
2
strZelle =
"$B$"
&
CStr
(Target.Row)
With
Target.EntireRow.Columns(
"B:H"
).
Select
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:=
"="
& strZelle &
"<> "
""
""
.FormatConditions(1).Font
.Bold =
True
.Italic =
False
.ColorIndex = 15
End
With
Target.EntireRow.Columns(
"B"
).
Select
If
Target =
""
Then
Exit
Sub
If
Not
IsDate(Target)
Then
Target =
Date
Target.Offset(0, 1) =
""
Target.Offset(0, 2) =
""
Case
3
strZelle =
"$C$"
&
CStr
(Target.Row)
With
Target.EntireRow.Columns(
"C:H"
)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:=
"="
& strZelle &
"<> "
""
""
.FormatConditions(1).Font
.Bold =
True
.Italic =
False
.ColorIndex = 3
End
With
Target.EntireRow.Columns(
"C"
).
Select
If
Target =
""
Then
Exit
Sub
If
Not
IsDate(Target)
Then
Target =
Date
Target.Offset(0, 1) =
""
Target.Offset(0, -1) =
""
Case
4
strZelle =
"$D$"
&
CStr
(Target.Row)
With
Target.EntireRow.Columns(
"D:H"
)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:=
"="
& strZelle &
"<> "
""
""
.FormatConditions(1).Font
.Bold =
True
.Italic =
False
.ColorIndex = 50
End
With
Target.EntireRow.Columns(
"D"
).
Select
If
Target =
""
Then
Exit
Sub
If
Not
IsDate(Target)
Then
Target =
Date
Target.Offset(0, -1) =
""
Target.Offset(0, -2) =
""
End
Select
Application.EnableEvents =
True
End
Sub