BeforeClose/ BeforeSave - required fields

triangulo

New Member
Joined
Dec 3, 2010
Messages
21
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.
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
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.
 

Some videos you may like

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Watch MrExcel Video

Forum statistics

Threads
1,099,027
Messages
5,466,114
Members
406,466
Latest member
mimi_b

This Week's Hot Topics

Top