I have the following code in sheet1 (note - this code is in the wroksheet object, not the workbook object or a module):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Integer
r = ActiveCell.Row
Cells(r - 1, 7).Value = Now()
ActiveWorkbook.save
End Sub
Can someone tell me why: 1. the ActiveWorkbook.save doesnt work above - it gets stuck in an infinite loop instead; 2. why I cant step throught the code by just pressing F8
I tried to put the ActiveWorkbook.save in a separate module and then call that function from the code in the worksheet but that got stuck in an infinite loop as well.
Application.EnableEvents = Falsejust before you do the update, then switch events back on after.Application.EnableEvents = Truein the Immediate pane of the VBE. Or put a breakpoint in your code so you can be sure it's actually getting triggered.