Hello! I usually use the following to compare values (which I recognize is clunky, but for smaller comparisons it gets the job done). I need to accomplish this comparison, but my ranges are too large, and Excel is locking up. This is my "go-to" method to accomplish this. I would love if someone could provide a bit of insight on how to "optimize" this method... Asking 1 question 79,171,600 times (115,075*688) seems a bit excessive here...
Sub Macro1()
Dim Cel As Range
Dim Rng As Range
Dim Cel2 As Range
Dim Rng2 As Range
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Set Rng = Range("A2:A688")
Set Rng2 = Range("J2:J115075")
For Each Cel In Rng
For Each Cel2 In Rng2
If Cel.Value = Cel2.Value And Cel.Offset(0, 1).Value = Cel2.Offset(0, 1).Value Then
Cel2.Offset(0, 5).Value = Cel.Offset(0, 3).Value
Else
End If
Next Cel2
Next Cel
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Sub Macro1()
Dim Cel As Range
Dim Rng As Range
Dim Cel2 As Range
Dim Rng2 As Range
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Set Rng = Range("A2:A688")
Set Rng2 = Range("J2:J115075")
For Each Cel In Rng
For Each Cel2 In Rng2
If Cel.Value = Cel2.Value And Cel.Offset(0, 1).Value = Cel2.Offset(0, 1).Value Then
Cel2.Offset(0, 5).Value = Cel.Offset(0, 3).Value
Else
End If
Next Cel2
Next Cel
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub