Hei.
I have this code and can't crack why I get Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction class
Any ideas?
I have this code and can't crack why I get Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction class
Any ideas?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
... 'some other working code
If (Target.Column = 13 Or Target.Column = 14 Or Target.Column = 15) Then
Application.ScreenUpdating = False
lastRowM = ActiveSheet.Range("M" & ActiveSheet.Rows.Count).End(xlUp).Row
lastRowN = ActiveSheet.Range("N" & ActiveSheet.Rows.Count).End(xlUp).Row
lastRowO = ActiveSheet.Range("O" & ActiveSheet.Rows.Count).End(xlUp).Row
lastRowLL = WorksheetFunction.Max(lastRowM, lastRowN, lastRowO)
If lastRowM > 3 And lastRowN > 3 And lastRowO > 3 Then
For i = 4 To lastRowO
On Error Resume Next
ActiveSheet.Range("P" & i) = Application.WorksheetFunction.VLookup(ActiveSheet.Range("O" & i), ActiveSheet.Range("M4:O" & lastRowLL), 2, False)
On Error GoTo 0
Next i
End If
Application.ScreenUpdating = True
End If
... 'some other working code
End Sub