The If statement is wrong, it should be And not Or.
Also, you should exit the inner loop as soon as an error is flagged.
Option Explicit
Sub error_checks()
'routine for checking for a range of possible user-derived errors
'dim vars
Dim ws As Worksheet
Dim cell As Range
Dim include_range As Range
Dim include_range_error_flag As Integer 'reports if the values in Include? column are not a 1 or a 0. Boolean?
'clear previous error reports
Worksheets("SummarySheet").Range("L28:N2000").ClearContents
'Check that the 'Include?' column only contains 1's or 0's
For Each ws In Worksheets
'use Set command to set the range of include_range (is the same on every DCM data sheet, E3:E33)
Set include_range = ws.Range("E3:E33")
If ws.Name Like String(Len(ws.Name), "#") Then 'check if worksheet name is numeric, only want to perform certain error checks on numeric tabs
For Each cell In include_range
If cell.Value <> 0 And cell.Value <> 1 Then
include_range_error_flag = 1
Exit For
End If 'wrong value in Include range so make error flag = 1
Next cell 'loop through each cell in include_range
End If
If include_range_error_flag = 1 Then 'if error flag = 1 then record worksheet name and reason for error
Sheets("SummarySheet").Range("L65000").End(xlUp).Offset(1, 0) = ws.Name
Sheets("SummarySheet").Range("N65000").End(xlUp).Offset(1, 0) = "Include column not 1 or 0"
End If
include_range_error_flag = 0 'reset error flag ready for next worksheet
Next 'assess next worsheet
End Sub
Bookmarks