Hi
I have some code which updates the user name and date in an audit sheet each time a workbook is saved. It's working great apart from one thing. When I save, the workbook switches to the Audit sheet, even though the Application.ScreenUpdating = False. Is there a way to have this code run without moving the user from the active cell they were in when they clicked the save button?
I have some code which updates the user name and date in an audit sheet each time a workbook is saved. It's working great apart from one thing. When I save, the workbook switches to the Audit sheet, even though the Application.ScreenUpdating = False. Is there a way to have this code run without moving the user from the active cell they were in when they clicked the save button?
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.ScreenUpdating = False
Dim UserChange
Dim DateChange
UserChange = Application.UserName
DateChange = Date & " " & Time
Sheets("Audit").Select
Range("a65536").End(xlUp).Offset(1, 0).Activate
ActiveCell.Value = UserChange
Sheets("Audit").Select
Range("b65536").End(xlUp).Offset(1, 0).Activate
ActiveCell.Value = DateChange
ActiveWorkbook.Save
Application.ScreenUpdating = True
End Sub