Trying to use the following assignment. Can not use relative referencing, that I know of, because the last column can change.
Dim LastCol as long
'Comment: LastCol = 90
This syntax:
Range("E2").Formula = "= "Average(" & Range (Cells(2,7), Cells(2, LastCol - 2 )) & ")" "
won't compile, says "Syntax error"
This syntax:
Range("E2").Formula = "= ""Average("" & Range (Cells(2,7), Cells(2, LastCol - 2 )) & "")"" "
just copies the text into the cell. The formula does not work.
Range("E2").Formula = "= Average(" & Range (Cells(2,7), Cells(2, LastCol - 2 )).Address & ")"
Note that I deleted two doublequotes as well.