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?!


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

    Application.EnableEvents = True
End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Running VBA clears the undo stack.
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?

>>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?
Other than copying the values before the code is run, no.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Seamus2626Author Commented:
Cool, thanks MacroShadow!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.