ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I create macro to add 8 rows at a time? (https://www.excelbanter.com/excel-worksheet-functions/195110-how-do-i-create-macro-add-8-rows-time.html)

GM

How do I create macro to add 8 rows at a time?
 
I have a worksheet with data that I need to insert 8 rows inbetween the other
rows in a spreadsheet. I tried creating a Macro but it records the cell
reference and just adds 8 rows at the same spot.

Gary Brown[_4_]

How do I create macro to add 8 rows at a time?
 
Range(ActiveCell.Address & ":" & _
ActiveCell.Offset(7, 0).Address).Insert _
Shift:=xlDown
will insert 8 rows starting at the cursor.
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"GM" wrote:

I have a worksheet with data that I need to insert 8 rows inbetween the other
rows in a spreadsheet. I tried creating a Macro but it records the cell
reference and just adds 8 rows at the same spot.


StumpedAgain

How do I create macro to add 8 rows at a time?
 
My guess is that you're only inserting a row for a particular cell. Try this:

Range("B5").EntireRow.Insert shift:=xlDown
--
-SA


"GM" wrote:

I have a worksheet with data that I need to insert 8 rows inbetween the other
rows in a spreadsheet. I tried creating a Macro but it records the cell
reference and just adds 8 rows at the same spot.


Glenn

How do I create macro to add 8 rows at a time?
 
GM wrote:
I have a worksheet with data that I need to insert 8 rows inbetween the other
rows in a spreadsheet. I tried creating a Macro but it records the cell
reference and just adds 8 rows at the same spot.


From the help file...

If you want the macro to run relative to the position of the active cell, record
it using relative cell references. On the Stop Recording toolbar, click Relative
Reference so that it is selected. Excel will continue to record macros with
relative references until you quit Excel or until you click Relative Reference
again, so that it is not selected.


Gary Brown[_4_]

How do I create macro to add 8 rows at a time?
 
You're absolutely right! Insert rows example below...

Range(ActiveCell.Row() & ":" & _
ActiveCell.Offset(7, 0).Row).Insert _
Shift:=xlDown

--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"StumpedAgain" wrote:

My guess is that you're only inserting a row for a particular cell. Try this:

Range("B5").EntireRow.Insert shift:=xlDown
--
-SA


"GM" wrote:

I have a worksheet with data that I need to insert 8 rows inbetween the other
rows in a spreadsheet. I tried creating a Macro but it records the cell
reference and just adds 8 rows at the same spot.



All times are GMT +1. The time now is 04:50 AM.

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