ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I add rows at fixed intervals-add values after every 5 Rows (https://www.excelbanter.com/excel-discussion-misc-queries/135539-how-do-i-add-rows-fixed-intervals-add-values-after-every-5-rows.html)

TUKUR

How do I add rows at fixed intervals-add values after every 5 Rows
 
My data is in a single Column from Row 2 to 6000. I need to add the values
after every 5 Rows.

Mayank Gupta

How do I add rows at fixed intervals-add values after every 5 Rows
 
Hi,

You can try writing this macro. Let me know if it helps:

Sub addRows()
Dim intcount As Integer
For intcount = 7 To 7200 Step 6 ' The first formula will appear in row 7
and there will be ~1200 such formula cells. So total is 7200
ThisWorkbook.Worksheets("Sheet1").Range("A" & intcount).Select
Selection.Insert Shift:=xlDown
Selection.Formula = "=Sum(A" & intcount - 1 & ":A" & intcount - 5 &
")"
Selection.Font.Bold = True ' To distinguish the totals row in
bold
Selection.Font.ColorIndex = 3 ' To distinguish the totals row in
Red
Next intcount
End Sub


"TUKUR" wrote in message
...
My data is in a single Column from Row 2 to 6000. I need to add the values
after every 5 Rows.




Dave Peterson

How do I add rows at fixed intervals-add values after every 5 Rows
 
I would add another column (say A) and put this in A2:

=INT((ROW()-2)/5)
And drag down.

Then I could select my range and do
Data|Subtotals
and create a subtotal based on that column.



TUKUR wrote:

My data is in a single Column from Row 2 to 6000. I need to add the values
after every 5 Rows.


--

Dave Peterson

TUKUR

How do I add rows at fixed intervals-add values after every 5
 
You are too much! More blessings for you.

"Dave Peterson" wrote:

I would add another column (say A) and put this in A2:

=INT((ROW()-2)/5)
And drag down.

Then I could select my range and do
Data|Subtotals
and create a subtotal based on that column.



TUKUR wrote:

My data is in a single Column from Row 2 to 6000. I need to add the values
after every 5 Rows.


--

Dave Peterson



All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com