0
=IFERROR(VLOOKUP(L19,DB,2,0),"")

need to convert this function to VBA in excel

  • at what cell do you want it this formula converted ? the active cell ? The second parameter inside your VLookup is `DB` , is that an error ? or a Named Range ? – Shai Rado Jul 09 '16 at 17:11
  • Possible duplicate of ["Unable to get the VLookup property of the WorksheetFunction Class" error](http://stackoverflow.com/questions/19280477/unable-to-get-the-vlookup-property-of-the-worksheetfunction-class-error) – m_callens Jul 09 '16 at 17:39

1 Answers1

0

Assuming you want the result of the formula in cell A19 (for example only), and DB is a named Range, try using the following code

Sub IsError_VLookup()

    If IsError(Application.WorksheetFunction.VLookup(Range("L19"), Range("DB"), 2, 0)) Then
        Range("A19").Value = ""
    Else
        Range("A19").Value = Application.WorksheetFunction.VLookup(Range("L19"), Range("DB"), 2, 0)
    End If

End Sub
Shai Rado
  • 33,032
  • 6
  • 29
  • 51