VBA Worksheet_Change not working

  • Hi there,


    Could any kind soul help me, i have spent a considerable amount of time searching and trying to get these 2 codes to work but couldn't.
    Is there any way i can combine these 2 codes? They serve 2 different purposes.


    1.
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
    If Len(Target) = 10 Then
    Range("I" & Target.Row & ":J" & Target.Row & ", K" & Target.Row & ", M" & Target.Row) = "N"
    End If
    End Sub


    2.
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 12 And Target.Value = "Y" Then
    Target.Offset(0, 1) = Date
    End If
    End Sub


    I tried to combine it into this


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("A:A")) Is Nothing Then Exit Sub
    If Len(Target) = 10 Then
    Range("I" & Target.Row & ":J" & Target.Row & ", K" & Target.Row & ", M" & Target.Row) = "N"
    End If
    If Target.Column = 12 And Target.Value = "Y" Then
    Target.Offset(0, 1) = Date
    End If
    End Sub


    But the 2nd code just wont work, i don't know whats wrong. Appreciate if anyone could assist in this!!

  • Try:

    You can say "THANK YOU" for help received by clicking the :thumbup: icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!