tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,834
- Office Version
- 365
- 2019
- Platform
- Windows
Can someone please explain when does Application.Undo work?
I have this event on a worksheet:
and this is ModUndo:
and it works when a value on Sheet1 is changed.
However if instead the event called another Function first, such as:
and CheckForRoll contains this:
I get an error in ModUndo.
Why is that?
Thanks
I have this event on a worksheet:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Call ModUndo.RollBack
End Sub
and this is ModUndo:
Code:
Sub RollBack
Application.EnableEvents = False
Application.Undo
App;ication.EnableEvents = True
End Sub
and it works when a value on Sheet1 is changed.
However if instead the event called another Function first, such as:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If CheckForRoll Then Call ModUndo.RollBack
End Sub
and CheckForRoll contains this:
Code:
Function CheckForRoll() As Boolean
If Sheet1.Cells(1, 1).Value = 10 Then
CheckForRoll = True
Else
CheckForRoll = False
End If
End Function
I get an error in ModUndo.
Why is that?
Thanks
Last edited: