To add row after 24 rows and get the sum

Solved/Closed
raja - Jan 28, 2010 at 12:34 AM
 RIZVISA1 - Jan 29, 2010 at 02:29 PM
Hello,
I have hourly data of one year in rows without any break. I want to add row after 24 hrs and get the sum of all the coumns in that row. In other words I wand to get the sum of daily data form hourly data
THANKS
Related:

1 response

with presumption that the data starts from A2 and is limited to column A

Dim lRowFactor As Integer
Dim lStart24HourRow As Integer
Dim lEnd24HourRow As Long

lStart24HourRow = 2
lRowFactor = 24


Do While Cells(lStart24HourRow, 1) <> ""

lEnd24HourRow = lStart24HourRow + lRowFactor

Rows(lEnd24HourRow).Insert

With Cells(lEnd24HourRow, 1)

.FormulaR1C1 = "=SUM(R" & lStart24HourRow & "C : R" & lEnd24HourRow - 1 & "C)"
.Font.Bold = True

End With

lStart24HourRow = lEnd24HourRow + 1

Loop
2