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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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