Code causing the undo and redo buttons not to work

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

When I disable this code the undo/redo buttons work. Why?
Can it be changed?
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal
Target As Excel.Range)
Application.EnableEvents = False
On Error GoTo ws_exit
If Not Application.Intersect(Target, Range("a:i")) Is
Nothing Then
Target(1).Value = UCase(Target(1).Value)
End If
Range("G2").Value = Date
ws_exit:
Application.EnableEvents = True
End Sub
 
Richard,

If VBA code makes any change to a worksheet, the Undo buffer is cleared.
This is just the way Excel is designed.
 
Back
Top