Hello Everyone,
I am a super basic vba user. I was wondering if someone would be able to show me how to adjust the code below to return the value "No Data" if a value is not there and to continue rather than throwing an error.
Thanks you so much
Sub IndexMatch()
Dim i As Integer
'Perform index match
For i = 2 To 11
Cells(i, 6).Value = WorksheetFunction.Index(ThisWorkbook.Worksheets("sheet1").Range("A2:A11"), _
WorksheetFunction.Match(Cells(i, 4).Value, ThisWorkbook.Worksheets("sheet1").Range("B2:B11"), 0))
Next i
End Sub
I am a super basic vba user. I was wondering if someone would be able to show me how to adjust the code below to return the value "No Data" if a value is not there and to continue rather than throwing an error.
Thanks you so much
Sub IndexMatch()
Dim i As Integer
'Perform index match
For i = 2 To 11
Cells(i, 6).Value = WorksheetFunction.Index(ThisWorkbook.Worksheets("sheet1").Range("A2:A11"), _
WorksheetFunction.Match(Cells(i, 4).Value, ThisWorkbook.Worksheets("sheet1").Range("B2:B11"), 0))
Next i
End Sub