If you don't have any other special formatting in the sheet, then you can quickly do it without macros (and assuming the line is actually a cell border).
Insert the first Line/border in the 8th row.
Select all cells above and including the 8th row.
Click the Format Painter button (looks like a paintbrush)
then select all the column headers (i.e. A,B,C...) for which you want to add the line to every 8th row.
Beware: this will also copy any other formats within those eight rows (which may be a good thing depending on why you are dividing the sheet up). Then all formats would copy down in the same fashion as the line.
Sub InsertRow()
LastRow = ActiveSheet.UsedRange.Rows.Count
For i = 8 To LastRow Step 8
Rows(i + Round(i / 8, 0) - 1).EntireRow.Insert
Rows(i + Round(i / 8, 0) - 1).Borders(xlEdgeBottom).LineStyle = xlContinuous
Next i
End Sub
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.