To add row after 24 rows and get the sum
Solved/Closed
Related:
- To add row after 24 rows and get the sum
- Fc 24 download pc - Download - Sports
- Fm 24 free download pc - Download - Simulation
- Pdf and xps add in 2007 - Download - Other
- Saints row 2 cheats - Guide
- How to add @ in laptop - Guide
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
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