=IFERROR(VLOOKUP(L19,DB,2,0),"")
need to convert this function to VBA in excel
=IFERROR(VLOOKUP(L19,DB,2,0),"")
need to convert this function to VBA in excel
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