Forum Discussion
date / time stamps in different columns
SOLVED
G'day all, I'm stuck on adding a 2 seperate date/timestamps to my WS. Ive pasted my VBA coding below..
I need to:
1. add date and time to column 1&2 when column 3 is filled (via drop down menu)
2. add date to column 19 when column 16 is filled (via drop down menu)
Note:
-header row is is in row 10
-if data is deleted, dates/times for that entry also need to clear
----------------------------------------------------------------------------------------
Private Sub worksheet_change(ByVal target As Range)
Application.EnableEvents = False
headerrow = 10
columnHeader = Cells(headerrow, target.Column).Value
'check if target cells are empty
If target.Column = 3 And Cells(target.Row, 1) = "" And Cells(target.Row, 2) = "" Then
'disable events
Application.EnableEvents = False
'insert current date into column 1
Cells(target.Row, 1) = Date
'Insert current time into column 2
Cells(target.Row, 2) = Time
'enable events Application.EnableEvents = True
'check if target cells are empty
If target.Column = 19 And
Cells(target.Row, 16) = "" Then
'disable events
Application.EnableEvents = False
'insert current date into column 19
Cells(target.Row, 19) = Date
'enable events Application.EnableEvents = True
End If
End If
End Sub