Automatically adding rows

Biffarama

New Member
Joined
May 18, 2010
Messages
27
Hello,

I'm wondering if there's a way to enter a number into a field and have that many rows created in another part of the sheet? For instance, in the example below, when I replace the "?" with a number I would like that number of rows created under the Jan-13 row, using the same formatting. Is this possible in Excel 2010?

Thanks,
Troy


Step 1Account Details
1aAccount NameTemplate
1bContract Start Date1/1/13
1cNumber of Months?
1dAccount Value$XXXX
1eDesired Margin2.5
1fMonthly CapXX
Step 2Labor costs
Tier CostSeat CostTotal
Jan-13

<tbody>
</tbody>
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
In my example above, on line 1c, if I entered a number in the cell where the ? is I want that many rows created under the row where Jan-13 is, with the same formatting as the Jan-13 row.

I hope that helps, thank you for your assistance.
 
Upvote 0
In my example above, on line 1c, if I entered a number in the cell where the ? is I want that many rows created under the row where Jan-13 is, with the same formatting as the Jan-13 row.

I hope that helps, thank you for your assistance.

ok but that ? is only one time or more then one can be how will it find where to start insert row ?
 
Upvote 0
Only one time

change the ? into any no and make that activecell and run the below code
Code:
Sub Insert_Row()
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(ActiveCell.Value, 0)).EntireRow.Insert
End Sub
 
Upvote 0
OK this is probably a stupid question, but where do I run that code? I put a number where the ? was, now how do I run that code?
 
Upvote 0
OK this is probably a stupid question, but where do I run that code? I put a number where the ? was, now how do I run that code?




  1. ALT + F11 ( VB Window Will Open)
  2. Insert Menu Insert New Module ( New Blank VB Window Will open)
  3. Paste The Code And Then Save then Close the window
  4. Now come back to Excel File And Press ALT + F8 Macro Will Show There Now Run The Macro
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

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.
Go back
Back
Top