asddsaasddas
Board Regular
- Joined
- Mar 23, 2020
- Messages
- 60
- Office Version
- 2016
- 2013
- Platform
- Windows
I want to execute a function Via VBA. However i want to use the IFERROR command to change the value of the cell if my VLOOKUP returns #N/A. However i was faced with a compile error and i don't know how to fix it. I will be posting my code below for reference. Do let me know if there is a way to solve my problem or is there a better way to complete my action to achieve my desired outcome.
VBA Code:
Sub Find_Error()
iLastRow = Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("incidents").Cells(2, 10).Formula = "=IFERROR(VLOOKUP(H2,Data,2,FALSE),"Error")"
Worksheets("incidents").Cells(2, 10).Copy
Range("j2:j" & iLastRow).Select
Selection.FillDown
End Sub