ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copying row & inserting (https://www.excelbanter.com/excel-discussion-misc-queries/108177-copying-row-inserting.html)

Chance224

Copying row & inserting
 
I'm using the macro below to insert a number of rows specified by a user. I
need to have it copy the row above the selected cell and insert the number of
rows specified and then delete the data in columns A,B,J,L in the rows
inserted.

Sub InsertRows()
Dim Rng
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
End Sub

Thanks,
Chance


David McRitchie

Copying row & inserting
 
see
Insert a Row using a Macro to maintain formula
http://www.mvps.org/dmcritchie/excel/insrtrow.htm
--
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Chance224" wrote in message ...
I'm using the macro below to insert a number of rows specified by a user. I
need to have it copy the row above the selected cell and insert the number of
rows specified and then delete the data in columns A,B,J,L in the rows
inserted.

Sub InsertRows()
Dim Rng
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
End Sub

Thanks,
Chance





All times are GMT +1. The time now is 08:59 PM.

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