Excel (VBScript) - Date Stamp when Row is Ammended

Soldato
Joined
10 May 2004
Posts
3,790
Location
East Yorkshire, UK
Hi

I have a bit of code, but I am trying to amend it to include:-

- Delete the date if the row is empty

Cheers

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Row > 12 Then Cells(Target.Row, "L") = Date
End Sub
 
Last edited:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    If Target.Row > 12 Then
        For i = 1 To 11
            t = Cells(Target.Row, i)
            If Not t = "" Then
                b = True
                Exit For
            End If
        Next
        If b = True Then
            Cells(Target.Row, "L") = Date
        ElseIf b = False Then
            Cells(Target.Row, "L") = ""
        End If
    End If
    Application.EnableEvents = True
End Sub

This is pretty basic, and assumes the data you're interested in sits in columns A to K. If the user highlights multiple rows and deletes their contents it won't work.
 
Back
Top Bottom