Private Sub Worksheet_Change(ByVal Target As Range)
'On Error GoTo ws_exit
'Tijd aanpassen
'If Target.Column = 3 Then
'lr = Range("A" & Rows.Count).End(xlUp).Row
' Range("A3", "U" & lr).Sort key1:=Range("A3"), order1:=xlAscending, key2:=Range("C3"), order2:=xlAscending, Header:=xlNo
'End If
'Opmaak vertrek
For Each c In Range("F3:F" & Range("F300").End(xlUp).Row)
If c = "SCHAARB.-VORM. BUNDEL C" Then
Range("F" & c.Row, "G" & c.Row).Font.ColorIndex = 5
Range("F" & c.Row, "I" & c.Row).Font.Bold = xlMedium
Range("A" & c.Row, "D" & c.Row).Font.ColorIndex = 5
Range("A" & c.Row, "D" & c.Row).Font.Bold = xlMedium
Range("H" & c.Row, "I" & c.Row).Font.ColorIndex = 5
Range("N" & c.Row, "N" & c.Row).Font.ColorIndex = 5
Range("R" & c.Row, "R" & c.Row).Font.ColorIndex = 5
Range("R" & c.Row, "R" & c.Row).Font.Bold = xlMedium
ElseIf c = "SCHAARB.-VORM. BUNDEL R" Then
Range("F" & c.Row, "G" & c.Row).Font.ColorIndex = 3
Range("F" & c.Row, "I" & c.Row).Font.Bold = xlMedium
Range("A" & c.Row, "D" & c.Row).Font.ColorIndex = 3
Range("A" & c.Row, "D" & c.Row).Font.Bold = xlMedium
Range("H" & c.Row, "I" & c.Row).Font.ColorIndex = 3
Range("N" & c.Row, "N" & c.Row).Font.ColorIndex = 3
Range("R" & c.Row, "R" & c.Row).Font.ColorIndex = 3
Range("R" & c.Row, "R" & c.Row).Font.Bold = xlMedium
ElseIf c = "SCHAARB.-VORM. BUNDEL P" Then
Range("F" & c.Row, "G" & c.Row).Font.ColorIndex = 10
Range("F" & c.Row, "I" & c.Row).Font.Bold = xlMedium
Range("A" & c.Row, "D" & c.Row).Font.ColorIndex = 10
Range("A" & c.Row, "D" & c.Row).Font.Bold = xlMedium
Range("H" & c.Row, "I" & c.Row).Font.ColorIndex = 10
Range("N" & c.Row, "N" & c.Row).Font.ColorIndex = 10
Range("R" & c.Row, "R" & c.Row).Font.ColorIndex = 10
Range("R" & c.Row, "R" & c.Row).Font.Bold = xlMedium
ElseIf c = "SCHAARB.-VORM. BUNDEL L" Then
Range("F" & c.Row, "G" & c.Row).Font.ColorIndex = 3
Range("F" & c.Row, "I" & c.Row).Font.Bold = xlMedium
Range("A" & c.Row, "D" & c.Row).Font.ColorIndex = 3
Range("A" & c.Row, "D" & c.Row).Font.Bold = xlMedium
Range("H" & c.Row, "I" & c.Row).Font.ColorIndex = 3
Range("N" & c.Row, "N" & c.Row).Font.ColorIndex = 3
Range("R" & c.Row, "R" & c.Row).Font.ColorIndex = 3
Range("R" & c.Row, "R" & c.Row).Font.Bold = xlMedium
End If
Next
'Opmaak aankomst
For Each o In Range("G3:G" & Range("G300").End(xlUp).Row)
If o = "SCHAARB.-VORM. BUNDEL C" Then
Range("G" & o.Row).Font.ColorIndex = 1
ElseIf o = "SCHAARB.-VORM. BUNDEL R" Then
Range("G" & o.Row).Font.ColorIndex = 3
ElseIf o = "SCHAARB.-VORM. BUNDEL P" Then
Range("G" & o.Row).Font.ColorIndex = 10
ElseIf o = "SCHAARB.-VORM. BUNDEL L" Then
Range("G" & o.Row).Font.ColorIndex = 3
End If
Next
'Kleur Via
For Each v In Range("K3:K" & Range("K300").End(xlUp).Row)
If v = "FBN" Then
Range("K" & v.Row).Interior.ColorIndex = 43
ElseIf v = "FVV" Then
Range("K" & v.Row).Interior.ColorIndex = 45
ElseIf v = "NVT" Then
Range("K" & v.Row).Interior.ColorIndex = xlNone
End If
Next
'Randen
If Target.Count = 1 Then
Select Case Target.Column
Case 1
If Target.Value >= "0" Then
Target.Resize(, 19).Borders.Weight = xlThin
Target.Offset(, 12).Resize(, 3).Borders.Weight = 3
End If
'Opmaak vertrek
'Case 6
' If Target.Value = "SCHAARB.-VORM. BUNDEL C" Then Y = 5
'If Target.Value = "SCHAARB.-VORM. BUNDEL R" Then Y = 3
'If Target.Value = "SCHAARB.-VORM. BUNDEL P" Then Y = 10
'If Target.Value = "SCHAARB.-VORM. BUNDEL L" Then Y = 3
' Target.Offset(, -5).Resize(, 4).Font.ColorIndex = Y
' Target.Offset(, -5).Resize(, 4).Font.Bold = xlMedium
' Target.Resize(, 4).Font.ColorIndex = Y
' Target.Resize(, 4).Font.Bold = xlMedium
' Target.Offset(, 8).Font.ColorIndex = Y
' Target.Offset(, 12).Font.ColorIndex = Y
' Target.Offset(, 12).Font.Bold = xlMedium
'Opmaak aankomst
'Case 7
' If Target.Value = "SCHAARB.-VORM. BUNDEL C" Then Y = 1
' If Target.Value = "SCHAARB.-VORM. BUNDEL R" Then Y = 3
' If Target.Value = "SCHAARB.-VORM. BUNDEL P" Then Y = 10
' If Target.Value = "SCHAARB.-VORM. BUNDEL L" Then Y = 3
' Target.Font.ColorIndex = Y
'Opmaak via
Case 11
Target.Interior.ColorIndex = IIf(Target.Value = "FBN", 43, IIf(Target.Value = "FVV", 45, xlNone))
'Spoor
Case 12
Target.Interior.ColorIndex = IIf(Target.Value >= "0", 36, xlNone)
'Opmaak rij
Case 18
If InStr(Target.Value, "BOOK IN") Then Target.Offset(, -17).Resize(, 10).Interior.ColorIndex = 36
If InStr(Target.Value, "BOOK IN") Then Target.Offset(, -5).Resize(, 6).Interior.ColorIndex = 36
If InStr(Target.Value, "LINEAS") Then Target.Offset(, -17).Resize(, 10).Interior.ColorIndex = 34
If InStr(Target.Value, "LINEAS") Then Target.Offset(, -5).Resize(, 6).Interior.ColorIndex = 34
'Opmaak vertraging vetrek
Case 4
If Target.Value > Target.Offset(, -1) Then Target.Offset(, 1).Resize.Font.ColorIndex = 3
'If Target.Value > Target.Offset(, -1) Then
'UserForm7.Show
If Target.Value <= Target.Offset(, -1) Then Target.Offset(, 1).Resize.Font.ColorIndex = 5
'Opmaak vertraging aankomst
Case 9
If Target.Value > Target.Offset(, -1) Then Target.Offset(, 1).Resize.Font.ColorIndex = 3
If Target.Value <= Target.Offset(, -1) Then Target.Offset(, 1).Resize.Font.ColorIndex = 5
End Select
End If
'ws_exit:
'Application.EnableEvents = True
End Sub