Code:

```
Sub SummarySheet2()
FinalRow = Sheets("Summary").Range("E50")
a = 2
x = Sheets.Count
For i = 1 To x
If Sheets("Detail " & i).Name = ("Detail " & i) Then
a = a + 1
Sheets("Summary").Select
Range("E" & a).Value = "Detail " & i & " Summary"
Range("H" & a).Formula = "=sum('Detail " & i & "'!M:M)/2"
Range("I" & a).Formula = "=sum('Detail " & i & "'!N:N)/2"
Range("J" & a).Formula = "=sum('Detail " & i & "'!O:O)/2"
End If
Next i
Exit Sub
End Sub
```

If I leave the exit sub after next i, then this does what I want to start with but then fails. If I move the Exit Sub above End If then it does not error on me, but doesn't run properly. Any help would be much appreciated.

Thanks, Mark