I have a WorkSheet Change macro to populate some formulas when certain cells change. So far I have difficult in using the macro to enter an Array formula. I keep getting error 'Method 'Range' object WorkSheet failed. Any ideas on how I can get the macro below to enter an Array Formula when some cell changes?

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim KeyCells As Range
    Set KeyCells = Range("E4:E1100")
    
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
    
    Application.EnableEvents = False

    Range("M4").Copy
    Range("M5:M1100").PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    Range("M5:M1100").Value = Range("M5:M1100").Value
    Application.CutCopyMode = False
    
    Range("O2:O1100").FormulaArray = "=IF(Master_Sales_Order="""",0, IFERROR(INDEX(value_for_posting,MATCH(Master_Sales_Order,IF(ISNUMBER(SEARCH(""comp"",part_type)),customer_order,0),0)),""NO P/O""))"
    Range("O2:O1100").Value = Range("O2:O1100").Value
    
    Application.EnableEvents = True
    
    End If
    
End Sub