VBA macro code to calculate average in a spreadsheet :
Sub calcaverage()
Range("D1").Select
ActiveCell.Value = "Average"
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell.Offset(0, -2))
ActiveCell.FormulaR1C1 = "=Average(RC[-3],RC[-2])"
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Sub calcaverage()
Range("D1").Select
ActiveCell.Value = "Average"
ActiveCell.Offset(1, 0).Select
Do While Not IsEmpty(ActiveCell.Offset(0, -2))
ActiveCell.FormulaR1C1 = "=Average(RC[-3],RC[-2])"
ActiveCell.Offset(1, 0).Select
Loop
End Sub
Thank you for taking the time to publish this information, very informative. Great job!
ReplyDeletewww.triciajoy.com