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>
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Biffarama

New Member
Joined
May 18, 2010
Messages
27
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.
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
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 ?
 

Biffarama

New Member
Joined
May 18, 2010
Messages
27

ADVERTISEMENT

Sorry, I'm not sure I understand whatyou mean?
 

Biffarama

New Member
Joined
May 18, 2010
Messages
27

ADVERTISEMENT

Only one time
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
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
 

Biffarama

New Member
Joined
May 18, 2010
Messages
27
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?
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,842
Messages
5,598,396
Members
414,235
Latest member
sucosama

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
Top