Worksheet_Change Event and undo

benntw

Board Regular
Joined
Feb 17, 2014
Messages
222
Office Version
  1. 365
Platform
  1. Windows
Does anyone know how to keep the undo along with worksheet change event. Here is my code that I am using.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range


'TRACKS DATE ENTRY WAS MARKED AS COMPLETE AND WHO UPDATED IT


If Target.Column = 21 Then
Application.EnableEvents = False
For Each rng In Target
If rng.Offset(0, 3).Value = "" Then
rng.Offset(0, 3) = Now()
End If
Next rng
Application.EnableEvents = True
End If


If Target.Column = 21 Then
Application.EnableEvents = False
For Each rng In Target
rng.Offset(0, 4) = Environ("Username")
Next rng
Application.EnableEvents = True
End If




'TRACKS DATE ENTRY WAS MARKED AS DELETED AND WHO UPDATED IT
If Target.Column = 22 Then
Application.EnableEvents = False
For Each rng In Target
If rng.Offset(0, 4).Value = "" Then
rng.Offset(0, 4) = Now()
End If
Next rng
Application.EnableEvents = True
End If


If Target.Column = 22 Then
Application.EnableEvents = False
For Each rng In Target
rng.Offset(0, 5) = Environ("Username")
Next rng
Application.EnableEvents = True
End If


End Sub


Thank you
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
It is not totally impossible but too advanced and not an easy task - there are some sources out there - basically you have to build your own undo history.
The only sure way to keep your undo history is not making changes to data in the workbook :)
 
Upvote 0
Thank you. I had a feeling it could be a big undertaking.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,198
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top