I am trying to copy and paste an array formula via a macro. It doesn't come up with a error message, it just doesnt copy the forumla into the relevant cell even though it displays it in the macro. any help? the macro is below

Range("M39").Select
Application.CutCopyMode = False
Selection.Copy
Range("E23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


the array formula is here too:

=INDEX($L:$L,MAX((IF($L$22:$L$44=0,"",ROW($L$22:$L$44)))))