In my macro, I have the following code :
i = Application.WorksheetFunction.Match(str_accrual, Range(Selection, Selection.End(xlToRight)), 0)
I used "If Not IsError" and the error kept showing. To prevent the error, add the following line as well:
On Local Error Resume Next