Hi all! I would like to add a script that forces the user to edit certain fields upon saving/closing the workbook. In the "Revision history" sheet, I've added a script that populates the date and author columns automatically, when Description and revision fields are edited. Se code below.
A B C D
Date Author Description Revision
26-Nov-2010 user1 Draft 0.1
13-Jan-2011 user2 aaa 0.2
17-Jan-2011 user2 xxx 0.3
...
I don't want the user to edit all the fields in the C and D columns, just on the next row after the last added row. Is that possible? I'm thinking an offset and count function but I can't get it to work properly.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Me.Cells(Target.Row, "A") = Date
Me.Cells(Target.Row, "B") = Environ("UserName")
Application.EnableEvents = True
End Sub
Date Author Description Revision
26-Nov-2010 user1 Draft 0.1
13-Jan-2011 user2 aaa 0.2
17-Jan-2011 user2 xxx 0.3
...
I don't want the user to edit all the fields in the C and D columns, just on the next row after the last added row. Is that possible? I'm thinking an offset and count function but I can't get it to work properly.