I have 2 sheets Sheet1 and Sheet2.
In Sheet1 There is a table which Column "C" has Item Numbers.(Approx. 60.000 Rows)
In Sheet2 There is a table which Column "C" has Item Numbers.(Approx. 50.000 Rows)
Starting from Sheet1 C2 cell to end of C Column (as C59850) ;
I'd like to count Item Numbers in Sheet2, to find how many Item Numbers exist in Sheet2 and put counting values to Column "V" for each.
In order to find the result for each Item Number in Sheet1, I used below code.
Sub Countif_Cell()
Application.ScreenUpdating = False
LR1 = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
LR2 = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To LR1
If WorksheetFunction.CountIf(Sheet2.Range("C2:C" & LR2), Sheet1.Cells(i, "C")) > 0 Then
Sheet1.Cells(i, "V") = WorksheetFunction.CountIf(Sheet2.Range("C2:C" & LR2), Sheet1.Cells(i, "C"))
End If
Next i
Application.ScreenUpdating = True
End Sub
But Excel gives "Not Responding" message and crash.
I want to use ADODB or ScriptingDictionary method instead of my code.
If there is a solution with ADO or ScriptingDictionary , I thank in advance for any reply and help.
Best regards.
Bookmarks