Adding Rows based on cell value entered

Rajiv87

New Member
Joined
Jan 14, 2016
Messages
1
Hi,

I want to add no of rows based on the value I enter in a particular cell.

For example, if I enter 4 in a cell I should get 4 rows added.

Any ideas or macros to do so???
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Put the value "4" in cell A1
Select a cell in the row where you want the rows inserted and run this script:
And 4 rows will be inserted below your active cell.
Change the value marked in red to your liking.
Code:
Sub Insert_Me()
Dim aa As Integer
aa = Cells([COLOR="#FF0000"]1, 1[/COLOR]).Value
ActiveCell.Offset(1).Resize(aa).EntireRow.Insert
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,695
Messages
6,126,263
Members
449,307
Latest member
Andile

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