On the sheet that contains about 700K row, I display on a column the last value in past row where ID is located of the current row
With my VBA code, it takes few hours How can I optimize that ? someone advice to change my code when using ubound but too complex for me ... :(
Can you help me ?
Sub Seekvba()
Dim C As Range, where As Range, whatt As String
Dim i As Long
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
For i = 2 To LastRow
On Error Resume Next
whatt = Range("O" + CStr(i)).Value
Set C = Range("O1:O" + CStr(i - 1))
Set where = C.Find(what:=whatt, after:=C(1), searchdirection:=xlPrevious, lookat:=xlWhole)
Cells(i, "S").Value = Mid(where.Address(0, 0), 2)
i = i + 1
Next i
End Sub
