Adds date to column1 when user enters text in column2.
Also, if user remove content from column2, macro will clear column1.
Currently macro has two columns connected to column1, need some modification if you need to customize it.
One of my small handy codes that I use daily.
Works on ActiveSheet only, expects user to have defined those columns in advance.

What is this?



Original Work
Sub UserChanged_Log4(Targ As Range)
    ' when user enters (selects) project id
    If Targ.Rows.Count > 1 Then Exit Sub
    If Targ.Columns.Count > 1 Then Exit Sub
    If Not (Targ.Column = 5 And Targ.Row > 5) Then Exit Sub
    If Targ.Value = "" Then
        Range("D" & Targ.Row).Value = ""
        Range("K" & Targ.Row).Value = ""
        Exit Sub
    End If
    If Range("D" & Targ.Row).Value = "" Then
        Range("D" & Targ.Row).Value = Date
        Range("K" & Targ.Row).Value = "C"
    End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
    UserChanged_Log4 Target
End Sub

Targ As Range

Views 99

Downloads 20