A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Does this work better?
Dim r1 As Range, vlu As String, lc As Long
Dim dic As Object
Set dic = CreateObject(Class:="Scripting.Dictionary")
lc = 24
For Each r1 In sh2.Range("A2", sh2.Range("A" & sh2.Rows.Count).End(xlUp))
vlu = Join(Application.Index(r1.Resize(, lc).Value, 1, 0), "|")
dic(vlu) = 1
Next r1
For Each r1 In sh.Range("A2", sh.Range("A" & sh.Rows.Count).End(xlUp))
vlu = Join(Application.Index(r1.Resize(, lc).Value, 1, 0), "|")
If dic.Exists(vlu) Then
MsgBox "Error EX01012", "Upload Error EX01012"
Application.CutCopyMode = False
OpenBook.Close SaveChanges:=False
Application.ScreenUpdating = True
Exit Sub
End If
Next r1