Hi Everyone,
I wrote the following code in order to match 5000 id numbers in LIST A , to 15000 id numbers in LIST B. This means 15000*5000=75 million loops. There are multiple items in LIST B that will match the ones in LIST A.
I had to add the workbook.save because it was freezing excel at item 6...I wonder what is bloating the cache so quickly.
My code is veeeery slow...any recommendations? maybe using arrays will be better? Thank you
I wrote the following code in order to match 5000 id numbers in LIST A , to 15000 id numbers in LIST B. This means 15000*5000=75 million loops. There are multiple items in LIST B that will match the ones in LIST A.
I had to add the workbook.save because it was freezing excel at item 6...I wonder what is bloating the cache so quickly.
My code is veeeery slow...any recommendations? maybe using arrays will be better? Thank you
HTML:
Sub MatchFilename()
Dim cell, cell2 As Range
Dim r As Integer
Application.ScreenUpdating = False
r = 0
For Each cell In Sheets("HDFileList").Range("d4:d14897")
For Each cell2 In Sheets("List").Range("al4:al4984")
Application.StatusBar = cell.Row & " item of 14897 " & "Matched: " & r
'cell.Select
'If cell = "" Then GoTo Jump2
If cell = cell2 Then
r = r + 1
Sheets("HDFileList").Range("G1") = r
'MsgBox "MATCH"
With cell.Offset(0, 3)
.Formula = "Yes" 'Matched
.Interior.Color = vbYellow
End With
cell.Offset(0, 4) = cell2.Offset(0, 1) 'Cat
cell.Offset(0, 5) = cell2.Offset(0, 2) 'Sub
Else
End If
Next cell2
ActiveWorkbook.Save
Next cell
MsgBox "Finished"
End Sub