PDA

View Full Version : Solved: multi summation of columns



demetre
09-13-2007, 05:49 AM
Good afternoon everyone

my current issue require the following

starting on Row 14 Column K till Column AC. I need to sum the values above each of those cells(always 12 cells above), then copy to the last row of another sheet which will hold all this data
13 cells below each of the cells above, I need to summate those values the same way, until last row, and again copiedAll worksheets are identical and each summation will be copied to the last row of another main sheet.

Any ideas would be helpful

thanks

Bob Phillips
09-13-2007, 06:07 AM
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iRow As Long
Dim sh As Worksheet

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
.Rows(1).Copy Worksheets("Master").Range("A1")
iRow = 1
For i = 14 To iLastRow Step 13
iRow = iRow + 1
For j = 8 To 29
Worksheets("Master").Cells(iRow, j).FormulaR1C1 = _
"=SUM('" & .Name & "'!R" & i - 12 & "C:R" & i - 1 & "C)"
Next j
Next i
End With

End Sub

demetre
09-13-2007, 06:17 AM
xld... thanks very much for your assistance :bow: