I'm trying to perform two calculations on a table to work out averages. Then do the same calculations in each sheet in my workbook. There are 'x' number of sheets. The tables in each sheet are dynamic in length. There's errors in this code that I'm trying to resolve
sub AvgCalculations
'x is a dynamic value and is the number of sheets in a workbook
For n = 3 to x
'Calculation 1 This calculates Average profit per unit
Sheets(n).range("B" & lastRow).Offset(2, 0).Value = Sheets(n).range("P" & lastRow).Offset(2).Value /
Sheets(n).range("I" & lastRow).Offset(2).Value
'Calculation 2 This calculates Average profit per order
'Sheets(n).range("A" & lastRow).Offset(2, 0).Value = Sheets(n).range("P" & lastRow).Offset(2).Value
/row("D").Column.Count
Application.ScreenUpdating = True
Next n
End Sub
Aucun commentaire:
Enregistrer un commentaire