Hi
Can anyone out there help me please!!
I'm trying to enter this formula into a cell via VBA but the date of the 19/05/2015 needs to be a variable but can't get it to work. It needs to refer to today's date when you run the macro.
ActiveCell.Offset(2, 0).Formula = "=AVERAGEIFS (Report1!H:H,Report1!G:G,""<>19/05/2015"",Report1!F:F,"">31/12/2013"",Report1!F:F,""<01/01/2015"")"
I've converted some of the code to R1C1 to refer to a cell in the spreadsheet that has the date see below. I'm not sure how to translate H:H etc into R1C1. Any one help please? And if you know an easier way to use a variable please let me know.
'ActiveCell.Offset(2, 0).Formula = "=AVERAGEIFS(Report1!H:H,Report1!G:G,>R[-2]C[0], Report1!F:F,"">31/12/2013"",Report1!F:F,""<01/01/2015"")"
Thanks in advance.
Mike
Bookmarks