Rich (BB code):
Sub Deploy()
Dim i, x, y, z As Long
Dim R1, R12 As Range
x = Cells(Rows.Count, "A").End(xlUp).Row
For i = 9 To x
R1 = Range("G" & i & ":J" & i)
R12 = Range("K" & i & ":M" & i)
y = Application.WorksheetFunction.Average(R1)
z = Application.WorksheetFunction.Average(R12)
Cells(i, "O") = Application.WorksheetFunction.Max(y, z)
Next i
End Sub
Excel is
[TABLE="width: 1061"]
<colgroup><col><col><col span="13"></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[/TR]
[TR]
[TD]S/L[/TD]
[TD]Prime[/TD]
[TD]UK[/TD]
[TD]Desc.[/TD]
[TD]Division[/TD]
[TD]Category[/TD]
[TD]W1[/TD]
[TD]W2[/TD]
[TD]W3[/TD]
[TD]W4[/TD]
[TD]W5[/TD]
[TD]W6[/TD]
[TD]W7[/TD]
[TD]W8[/TD]
[TD]DMD[/TD]
[/TR]
[TR]
[TD]DDD[/TD]
[TD]TTTT[/TD]
[TD]E2[/TD]
[TD]rrrr[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]0[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Getting error in bold line Plz help
Last edited by a moderator: