Hello Excellent Excellers!
I'm sorry if this topic has been covered ad nauseum, however, I'm sporadically encountering the "Code Execution has been Interrupted" error on a sorting macro. I never used CTRL-break (a possible cause mentioned in previous threads) and the macro has worked "flawlessly" from it's creation to now. Suddenly excel is claiming a "Code Execution Interrupted" that moves around the code. Of course, I researched this mystery and decided to use the option:
Application.EnableCancelKey = xlDisabled
While this seems to work, I'm anxious that this workaround might cause problems further down the road. If you don't mind, please have a look at a portion of the code from which the error is occurring. Am I doing something that's causing this error to start popping up?
This module is attached to a form control button that sorts my entries, and has worked well until today:
Sub SortButtonRoster_Click()
'Added in the following to "Fix" my error
Application.EnableCancelKey = xlDisabled
Range("A22:B26").Sort _
Key1:=Range("B22"), Order1:=xlDescending, _
Key2:=Range("A22"), Order2:=xlAscending
Range("A32:B102").Sort _
Key1:=Range("B32"), Order1:=xlDescending, _
Key2:=Range("A32"), Order2:=xlAscending
Range("A108:B126").Sort _
Key1:=Range("B108"), Order1:=xlDescending, _
Key2:=Range("A108"), Order2:=xlAscending
Range("A132:B182").Sort _
Key1:=Range("B132"), Order1:=xlDescending, _
Key2:=Range("A132"), Order2:=xlAscending
Range("A188:B206").Sort _
Key1:=Range("B188"), Order1:=xlDescending, _
Key2:=Range("A188"), Order2:=xlAscending
Range("A212:B226").Sort _
Key1:=Range("B212"), Order1:=xlDescending, _
Key2:=Range("A212"), Order2:=xlAscending
Range("A232:B246").Sort _
Key1:=Range("B232"), Order1:=xlDescending, _
Key2:=Range("A232"), Order2:=xlAscending
End Sub
As always, your help and patience is greatly appreciated!
Bookmarks