• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

macro required for average

webmax

Member
Hi

I am attaching the sample file which contains two sheets

In the first data & Second Data i want the macro to put the average of Total wages / Total number of days.

For sample purpose i am attaching the two sheets 4 sample datas.

In the original the data nos will vary 10 to 50000 nos of record .

I have 100 Nos of Files like this in that i am able to put average. For that i have to manually open the file and put the average formula. I want this through macro.

Kindly help.

regards
Shahul
 

Attachments

  • macro reqd.xlsx
    10.3 KB · Views: 4
Seems like an odd request, but here you go.
Code:
Sub PutAverage()
Dim ws As Worksheet
'Take Total / # of Days
Const myFormula As String = "=RC[-1]/RC[-3]"

Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
    With ws
        'Finds last cell in col E, puts AVERAGE formula next to it
        .Cells(.Rows.Count, "E").End(xlUp).Offset(0, 1).FormulaR1C1 = myFormula
    End With
Next ws
Application.ScreenUpdating = True
End Sub
 
Back
Top