FOR SOME REASON IM NOT ABLE TO COMMENT. The answers below all gave me a variety of errors from activex cannot create object to object undefined.
This is my code.
Sub Main()
Application.ScreenUpdating = False
Dim stNow As String
stNow = Now
Set sh1 = ThisWorkbook.Worksheets("StrategyIn")
Set sh2 = ThisWorkbook.Worksheets("Contractor")
Dim arr As Variant
arr = sh1.Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row).Value
Dim varr As Variant
varr = sh2.Range("E2:E" & Range("E" & Rows.Count).End(xlUp).Row).Value
Dim temp As Integer
temp = 0
Dim x As Variant, y As Variant, Match As Boolean
For Each x In arr
Match = False
For Each y In varr
If x = y Then Match = True
Next y
If Not Match Then
temp = temp + 1
End If
Next
MsgBox "Number of names that do not match = " & temp
'Debug.Print DateDiff("s", stNow, Now)
Application.ScreenUpdating = True
End Sub
It works when I remove the reference to other worksheets to get the range, works perfectly when I am in one sheet and data is all gathered in one sheet. There is a logical error which results in me getting a number of names that do no match as = 1. Thanks for your help!