Hi guys,
I am having a problem with some of my code. Codes that worked weeks, months even years ago are now starting to give me problems. I cant seem to work out why.
I keep getting "Code execution has been interrupted" errors. I thought you could only get these errors when you press 'break' or 'esc'?
The code below traces dependants for a block of cells. It worked last time I tried it and now errors at Application.ScreenUpdating = False
I know I could use Application.EnableCancelKey = xlDisabled but I want to get to the root of the cause not just work around it.
Thanks to all in advance.
Richard
I am having a problem with some of my code. Codes that worked weeks, months even years ago are now starting to give me problems. I cant seem to work out why.
I keep getting "Code execution has been interrupted" errors. I thought you could only get these errors when you press 'break' or 'esc'?
The code below traces dependants for a block of cells. It worked last time I tried it and now errors at Application.ScreenUpdating = False
I know I could use Application.EnableCancelKey = xlDisabled but I want to get to the root of the cause not just work around it.
Thanks to all in advance.
Richard
Code:
Sub FindDependants()
'############################################
' #
' Written by Richard Nero 7th October 2011 #
' #
'############################################
Dim MyRange As Range
On Error GoTo EndCode
'Choose your area you wish to trace dependants
Set MyRange = Application.InputBox("Select your area you wish to trace dependants:", "Auto Trace Dependant v0.1", Type:=8)
[COLOR=#ff0000]Application.ScreenUpdating = False
[/COLOR]'Cancel the routine if cancel is pressed
If MyRange Is Nothing = True Then
'Display message
MsgBox "The Auto Trace Dependant utility has been canceled", vbInformation
'Exit the routine and close the macro
Exit Sub
End If
'Loop through the range
For Each Cell In MyRange
'Select the cell
Cell.Select
'Trace dependants
Selection.ShowDependents
Next Cell
EndCode:
Application.ScreenUpdating = True
End Sub