mykal66
02-17-2020, 03:13 AM
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
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