- Joined
- May 30, 2011
- Messages
- 4
- Reaction score
- 0
I found this piece of code and adjusted it to my needs. The only things is that WorksheetFunction.Average does not work. The sum works find but I dont need sum of the value I need Averages. I have tried a couple of things with no avail. Please help and thanks for all your help.
This is my code:
Sub CCC()
Dim aArea As Range, i As Integer
For Each aArea In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Areas
For i = 3 To 3
With Cells(aArea.Row + aArea.Rows.Count, i)
.value = WorksheetFunction.Sum(Range(Cells(aArea.Row, i), Cells(aArea.Row + aArea.Rows.Count - 1, i)))
With .Font
.ColorIndex = 5
.Bold = True
End With
End With
Next i
Next aArea
End Sub

This is my code:
Sub CCC()
Dim aArea As Range, i As Integer
For Each aArea In ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants).Areas
For i = 3 To 3
With Cells(aArea.Row + aArea.Rows.Count, i)
.value = WorksheetFunction.Sum(Range(Cells(aArea.Row, i), Cells(aArea.Row + aArea.Rows.Count - 1, i)))
With .Font
.ColorIndex = 5
.Bold = True
End With
End With
Next i
Next aArea
End Sub
Last edited: