Error message: Code execution has been interrupted

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Can anyone help me understand why I'm getting an error message
"Code execution has been interrupted"
on the last line of the code below when I run the macro? F8/stepping through it works fine:
Rich (BB code):
Sub DMISHemaSynch()
Dim LR As Long
Dim rng As Range

With Application
   .ScreenUpdating = True
   .DisplayAlerts = False
End With
Dim i As Long, j As Long
j = Worksheets.Count
For i = 1 To j
    Select Case Sheets(i).Name
        Case "Hema", "Baseline DMIS", "Audit DMIS"
    Case Else
        Sheets(i).Delete
        i = i - 1
    End Select
    If i >= Worksheets.Count Then Exit For
Next i
Sheets.Add before:=Sheets(1)
ActiveSheet.Name = "Indeterminate Info"
Sheets.Add
ActiveSheet.Name = "Resolve Hemasphere Duplicates"
Sheets.Add
ActiveSheet.Name = "Not in Hemasphere"
With Sheets("Hema")
    .Select
    If .AutoFilterMode Then .AutoFilterMode = False
    LR = .Range("A" & Rows.Count).End(xlUp).Row
    With .Range("E2")
        .Formula = "=COUNTIF($A$2:$A$" & LR & ",A2)"
        .AutoFill Range("E2:E" & LR)
    End With
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top