Hi All,

I am trying to run multiple 'Private Sub Worksheet_Change(ByVal Target As Range)' in one and it gives me an error.

Could anyone please help me what I did wrong? Please see a code below:


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or Target.Column <> 4 Or Target.Row < 3 Then Exit Sub

Cells(Target.row,5).Value = Now
End Sub
If Target.Column = 6 Then

Dim lastRow As Long
lastRow = Cells(Rows.Count, 6).End(xlUp).Row
Range("A3:F" & lastRow).Sort key1:=Range("F3:F42" & lastRow), order1:=xlAscending, Header:=xlNo

End If

End Sub


Thank you in advance!

Best regards,

Jan