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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
Office Version
  1. 365
Platform
  1. Windows
yes it is possible explain what actual u need ?
 

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
Office Version
  1. 365
Platform
  1. Windows
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?
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
Office Version
  1. 365
Platform
  1. Windows
Sorry, I'm not sure I understand whatyou mean?

sorry for that
but i want to know that in your example data there is only one time ? so it can be more or only one time ?
 

Biffarama

New Member
Joined
May 18, 2010
Messages
27

ADVERTISEMENT

Only one time
 

kevatarvind

Well-known Member
Joined
Mar 3, 2013
Messages
1,047
Office Version
  1. 365
Platform
  1. Windows
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
Office Version
  1. 365
Platform
  1. Windows
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,028
Messages
5,835,032
Members
430,333
Latest member
jaypatel1298

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