Public Sub ProcessData()
Dim LastRow As Long
Dim LastCol As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
LastCol = .Cells(10, .Columns.Count).End(xlToLeft).Column
.Cells(LastRow + 1, "B").Resize(, LastCol - 1).Formula =
"=AVERAGE(B10:B" & LastRow & ")"
End With
End Sub

Signature
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
>I need to use the average function in the row after the last row of data in
> column B that calculates the average of range (B10:last cell of data in
[quoted text clipped - 4 lines]
> This spreadsheet for my teachers will vary in size and my novice ability
> with VB has me stuck. I would really appreciate any help with this.
VistaOnMyMac :) - 28 Mar 2008 15:09 GMT
Bob,
Thank you so much. It worked great! How would I add formatting tasks to
the same cells. For example:
.NumberFormat = "0.0"
Bob Phillips - 29 Mar 2008 01:05 GMT
Public Sub ProcessData()
Dim LastRow As Long
Dim LastCol As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
LastCol = .Cells(10, .Columns.Count).End(xlToLeft).Column
With .Cells(LastRow + 1, "B").Resize(, LastCol - 1)
.Formula = "=AVERAGE(B10:B" & LastRow & ")"
.NumberFormat = "0.0"
End With
End With
End Sub

Signature
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
> Bob,
>
> Thank you so much. It worked great! How would I add formatting tasks to
> the same cells. For example:
> .NumberFormat = "0.0"