can somebody please advise me what i am doing wrong
my data lies in row 27 and row 28, and is updated monthly
i want the answer to be in "h20" (which is 8 rows above the data)
i can't figure out how to direct the macro to capture the last column to then apply the formula, i am also having drama's with" xltoright"
any advice would be appreciated
my macro so far seems to be capturing rows not columns and i am getting a circular ref as a result.
Sub seps_rate()
LastCol = Cells(8,Columns.Count).End(xlToRight).Columns
Range("h20").Formula = "=SUM( 28" & LastCol - 11 & ":28" & LastCol & ") / (((AVERAGE( 27t" & LastCol - 12 & ",27" & LastCol & ")+ SUM( 27" & LastCol - 1 & ":27 " & LastCol - 1 & "))/12)) "
End Sub
my data lies in row 27 and row 28, and is updated monthly
i want the answer to be in "h20" (which is 8 rows above the data)
i can't figure out how to direct the macro to capture the last column to then apply the formula, i am also having drama's with" xltoright"
any advice would be appreciated
my macro so far seems to be capturing rows not columns and i am getting a circular ref as a result.
Sub seps_rate()
LastCol = Cells(8,Columns.Count).End(xlToRight).Columns
Range("h20").Formula = "=SUM( 28" & LastCol - 11 & ":28" & LastCol & ") / (((AVERAGE( 27t" & LastCol - 12 & ",27" & LastCol & ")+ SUM( 27" & LastCol - 1 & ":27 " & LastCol - 1 & "))/12)) "
End Sub