Option
Explicit
Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
Dim
start
As
Integer
Dim
start1
As
Integer
Dim
ziel
As
Integer
Dim
anz
As
Integer
If
Target.Column = 2
Or
Target.Column = 3
Or
Target.Column = 4
Then
If
Cells(Target.Row, 2) <>
""
And
Cells(Target.Row, 3) <>
""
_
And
Cells(Target.Row, 4) <>
""
Then
Range(
"F"
& Target.Row,
"IV"
& Target.Row).Interior.ColorIndex = x1None
start1 = 5
start = Format(Cells(Target.Row, 3),
"hh"
)
ziel = Format(Cells(Target.Row, 4),
"hh"
)
Do
While
Cells(1, start1) <> Cells(Target.Row, 2)
start1 = start1 + 1
Loop
If
start > ziel
Then
anz = (24 - start) + ziel
Else
: anz = ziel - start
End
If
start = start + start1
anz = anz + start + 1
Do
While
start < anz
Cells(Target.Row, start).Interior.ColorIndex = 6
start = start + 1
Loop
End
If
End
If
End
Sub