Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing Undo ability because of macro 1

Status
Not open for further replies.

jmstarbuck

Programmer
Aug 11, 2003
90
US
Hi all,

I'm very new to the Excel macro world and I have encountered a problem with losing the ability to undo.

My code runs under the SheetChange event.

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
     Application.EnableEvents = False
     ActiveSheet.Unprotect
     'lots of following  
     If IsEmpty(ActiveSheet.Cells(Target.Row, 19)) Then
        ActiveSheet.Cells(Target.Row, "S").Value = "FALSE"
     End If

     ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowInsertingRows:=True, AllowFormattingRows:=True
   
     Application.EnableEvents = True
End Sub
I think that I have to Disable Events, because I was looping when I didn't.
I've played with various Protect options to no avail.
Thoughts?

Best,
J
 
A common side effect of some macros is that the Undo/Redo stack is lost; especially if it is a change event

Try running your file in Safe Mode and see if Undo is available.

If it is NOT, then check out the article below.


If there are add-ins - those could be contributing to the problem as well.



Canadian eh! Check out the new social forum Tek-Tips in Canada.
I should live a long time - I eat a lot of preservatives.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top