ive lost my undo button

My undo button and ctrl z is not working.

I have a sneaky suspicion it is something to do with a worksheet change piece of code I have

Can someone investigate?!

Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim sRange                As String
    On Error GoTo reset
    If Not Intersect(Target, Range("M5")) Is Nothing Then
        Application.EnableEvents = False
        Range("K5:L" & Rows.Count).Clear
        Select Case UCase$(Range("M5").Value)
            Case "ASIA"
                sRange = "ASP"
            Case "EUROPE"
                sRange = "EU"
            Case "LATIN AMERICA"
                sRange = "LA"
            Case "MIDDLE EAST"
                sRange = "ME"
            Case "NORTH AMERICA"
                sRange = "NA"
            Case Else
                sRange = vbNullString
        End Select
        If sRange <> vbNullString Then Range("BurstALL_" & sRange).Copy Range("K5")
    End If

reset:
    Application.EnableEvents = True
End Sub

Open in new window

Seamus2626Asked:
Who is Participating?
 
MacroShadowCommented:
>>As the vba is working on an event change (worksheet change) does that mean Il never have undo on this workbook?
Correct.

>>Is there a workaround?
Other than copying the values before the code is run, no.
0
 
MacroShadowCommented:
Running VBA clears the undo stack.
0
 
Seamus2626Author Commented:
As the vba is working on an event change (worksheet change) does that mean Il never have undo on this workbook?

Is there a workaround?

Thanks
0
 
Seamus2626Author Commented:
Cool, thanks MacroShadow!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.