Hello all,
I would like some help with a macro that I have, I was able to create this formula that I entered into a cell and got the results I wanted.
=IFERROR(INDEX({"Machine 1","Machine 2","Machine 3"},MATCH(LEFT(A2,4),{"5000","5001","5002"},0)),"")

excel.jpg

When pasting this code into my macro I get the following error
Compile error:
Expected: expression

Below is what my macro code looks like. Any help would be greatly appreciated. Thanks


Range("O2").Select
ActiveCell.FormulaR1C1 = _
=IFERROR(INDEX({"Machine 1","Machine 2","Machine 3"},MATCH(LEFT(A2,4),{"5000","5001","5002"},0)),"")
Selection.NumberFormat = "0"
Range("O2").Select
Selection.Copy
Range("N3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False