ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto insert blank rows (https://www.excelbanter.com/excel-programming/385234-auto-insert-blank-rows.html)

Constantly Amazed

Auto insert blank rows
 
Hi

I have to repetitively handle a file with a list of reference numbers in
column A. The number of rows varies each time the task is carried out. The
rows are a continuous list. It is necessary to insert a blank line between
each row containing an entry. Could anyone provide a macro which establishes
how many rows there are in the list and then automatically inserts a blank
row between each entry?

Thank you for any assistance.

G

merjet

Auto insert blank rows
 
Sub InsertRows_()
Dim iEnd As Long
Dim iRow As Long

iEnd = Range("A1").CurrentRegion.Rows.Count
For iRow = iEnd To 1 Step -1
Rows(iRow + 1).Insert xlShiftDown
Next iRow
End Sub

Merjet



Constantly Amazed

Auto insert blank rows
 
Hi Merjet

That appears to work fine. Thanks very much for your help

"merjet" wrote:

Sub InsertRows_()
Dim iEnd As Long
Dim iRow As Long

iEnd = Range("A1").CurrentRegion.Rows.Count
For iRow = iEnd To 1 Step -1
Rows(iRow + 1).Insert xlShiftDown
Next iRow
End Sub

Merjet





All times are GMT +1. The time now is 06:17 AM.

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