Hello,
I have the following code:
Sub cluster_compare()
Dim j As Long
Dim maxrows As Long
Workbooks.Open ("../Cluster.xlsx") 'I deleted a URL here that isn't relevant for my question.
maxrows = IIf(IsEmpty(ThisWorkbook.Worksheets("VV").Cells(Rows.Count, 1)), ThisWorkbook.Worksheets("VV").Cells(Rows.Count, 1).End(xlUp).Row, Rows.Count)
For j = 2 To maxrows
With Workbooks("Cluster.xlsx").Worksheets("Contracts").Range("B:B")
If IsEmpty(ThisWorkbook.Worksheets("VV").Cells(j, 22)) = True Then
GoTo 1:
Else
Set C = .Find(ThisWorkbook.Worksheets("VV").Cells(j, 22), LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=True)
If Not C Is Nothing Then
FirstAdress = C.Row
Do
ThisWorkbook.Worksheets("VV").Cells(j, 21) = Workbooks("Cluster.xlsx").Worksheets("Contracts").Cells(C.Row, 1)
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Row <> FirstAdress
End If
C = ""
End If
End With
1:
Next j
It already does what I want. It's just incredibly slow. I have over 250.000 rows (Sheet "VV" in my base workbook) and my code takes over 2 hours to compare them to a 250 row long list (Cluster.xlsx, Sheets Contracts) of reference points. Not every row in my relevant column has a value, so I already skip empty ones.
Is there a way to do it faster?
Bookmarks