ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I insert a row or rows between each row of text and copy the row above? (https://www.excelbanter.com/excel-discussion-misc-queries/447737-how-do-i-insert-row-rows-between-each-row-text-copy-row-above.html)

drea5845

How do I insert a row or rows between each row of text and copy the row above?
 
I have been using this macro to insert rows depending on how many I need.

When I need more rows interested I just change the number by numRows=

I would like to know how I can copy the row above to the new inserted row. I would like to do this for large amounts of data. As of now I just do this manually and it can be very time consuming.

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
numRows = 1
For r = 265 To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).EntireRow.Insert
Next r
Application.ScreenUpdating = True
End Sub


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

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