The sheet "Main" has 104334 entries (lr) and sheet "Sheet1" has 26500 entries (LRb). The macro is an overkill, takes an eternity.
Is there any way to make it faster or possible alternatives...experts please help!
Note: the functionality is to lookup Main sheet col A entries in Sheet1, and indicate a match by 1 or a no match by 0.
Is there any way to make it faster or possible alternatives...experts please help!
Code:
Sub mymac()
Dim j, i, lr, LRb As Long
Dim temp As Integer
Sheets("Main").Select
lr = ActiveSheet.UsedRange.Rows.Count
LRb = Range("'Sheet1'!" & "A" & Rows.Count).End(xlUp).Row
Application.ScreenUpdating = False
For i = 2 To lr
temp = WorksheetFunction.CountIf(Range("'Sheet1'!" & "A2:A" & LRb), Range("A" & i).Value)
If temp = 0 Then
Range("D" & i).Value = 0
Else
Range("D" & i).Value = 1
End If
Next
Application.ScreenUpdating = True
End Sub
Note: the functionality is to lookup Main sheet col A entries in Sheet1, and indicate a match by 1 or a no match by 0.