TopLinks


“Code execution has been interrupted” in Excel vba macros.

This morning I started to get this strange error in one of my Excel spreadsheets that was working perfectly well last week! seems Excel has a "bad case of the mondays!"

So i searched google for a fix, and the only solution seemed to be to add the following line of code to the start of the function:

 “Application.EnableCancelKey = xlDisabled”

This was a quick and dirty solution, but it didn't explain the root cause of the problem.
After a bit of investigation i found that on another worksheet i had some cells referencing a function that no longer existed, and for some bizarre reason my macro on a totally different worksheet that was getting interrupted was triggering those cells to update - no idea why!
So i deleted the cells that referenced the missing function, and the problem went away.

Not 100% sure if that was the route cause, but it did seem to solve my problem on this occasion :)


happy coding guys and girls :)




No comments:

Post a Comment