Attached you will find the file with my issue. I am trying to create a "log" Sheet to keep up with changes on the worksheet with VBA because Built-In Change Tracking is not quite robust enough for my purposes. I'm not great with VBA but figuring out a little as I go along.
Problem 1: Copy and paste 2 cells over two cells and only the value out of one cell is returned to previousvalue. Same goes for new value.
Problem 2: If I insert/delete a row or column, the macro goes into infinite loop.
Problem 3: If I select the entire sheet to make a formatting change or something, I get a Run Time Error 7: Out of Memory Error.
Dim PreviousValue
Private Sub Worksheet_Change(ByVal Target As Range)
For Each TheCell In Target.Cells
Worksheets("log").Activate
Sheets("log").Range("a1").Select
Sheets("log").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).Select
ActiveCell = Target.Address
ActiveCell.Offset(0, 1) = PreviousValue
ActiveCell.Offset(0, 2) = Target.Value
Next
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PreviousValue = Target.Value
End Sub
Bookmarks