Consulting

Results 1 to 3 of 3

Thread: Automatically updating date cell unless row is blank

  1. #1
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location

    Automatically updating date cell unless row is blank

    Hi again folks, stuck again if anyone can help please?

    I have a workbook that people are supposed to add the date any changes were made in a row but they never do so i have used VBA to automatically update the date when data is changed in the row - code below.

    This works fine until another event moves the row data from one tab to another (deleting the original row), this still triggers the date in column D leaving the row with just a date in column D as everything has been moved to another tab.

    Is there a way to adapt this code to only trigger if there is still date data in the row or use a column as a trigger e.g. Column A would always have a date in it so of the row is moved the Cell in Column A would be blank so Column D doesn't need a date

    Thanks

    Mykal



    Private Sub Worksheet_Change(ByVal Target As Range)Application.ScreenUpdating = False
    
    
    If Target.Row = 1 Then Exit Sub
    Application.EnableEvents = False
         Cells(Target.Row, "D").Value = Date
    Application.EnableEvents = True
    End Sub

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    If Target.EntireRow.Count = 1 then
        'D = ""
       Exit Sub
    Else 
       'D = Date
    End If
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Contributor
    Joined
    Jul 2011
    Location
    Manchester
    Posts
    142
    Location
    Hi Sam

    Thank you very much. It didn't work but i am going to just pull the last updated column from the workbook this time. Thanks again. Maykal

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •