Hi,
I am trying to get an average of a weeks worth of results.
This is what I have tried
Sub PaymentFunnelsAutomate2()
'
Sheets("DATA").Select
Range("a1").Select
Selection.End(xlToRight).Select
Dim c As Range
Set c = ActiveCell
Sheets("DATA").Select
Range("a3").Select
Selection.End(xlToRight).Select
Dim d As Range
Set d = ActiveCell
If c + 13 = d Then
Sheets("DATA").Select
Range("A1").Select
Selection.End(xlToRight).Select
Selection.Offset(0, 1).Select
ActiveCell = c + 7
'need to include the code for adding the weekly figures
Sheets("EM").Select
Range("A31").Select
Selection.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1:G1").Select
ActiveCell.Activate
Dim e As Range
Set e = ActiveCell
Sheets("Weekly EM %").Select
Range("E31").Select
Selection.End(xlToRight).Select
Selection.Offset(0, 1).Select
ActiveCell = Average(EM!e)
End If
End Sub
But I get a compile error on the last line of code, the Average function
Compile error: Sub or function not defined
Can anybody help to clear up why and maybe offer a solution?
Thanks,
Jaime
I am trying to get an average of a weeks worth of results.
This is what I have tried
Sub PaymentFunnelsAutomate2()
'
Sheets("DATA").Select
Range("a1").Select
Selection.End(xlToRight).Select
Dim c As Range
Set c = ActiveCell
Sheets("DATA").Select
Range("a3").Select
Selection.End(xlToRight).Select
Dim d As Range
Set d = ActiveCell
If c + 13 = d Then
Sheets("DATA").Select
Range("A1").Select
Selection.End(xlToRight).Select
Selection.Offset(0, 1).Select
ActiveCell = c + 7
'need to include the code for adding the weekly figures
Sheets("EM").Select
Range("A31").Select
Selection.End(xlToRight).Select
ActiveCell.Offset(0, -6).Range("A1:G1").Select
ActiveCell.Activate
Dim e As Range
Set e = ActiveCell
Sheets("Weekly EM %").Select
Range("E31").Select
Selection.End(xlToRight).Select
Selection.Offset(0, 1).Select
ActiveCell = Average(EM!e)
End If
End Sub
But I get a compile error on the last line of code, the Average function
Compile error: Sub or function not defined
Can anybody help to clear up why and maybe offer a solution?
Thanks,
Jaime