Enter rows automatically by accepting a number

asokaw

New Member
Joined
Jun 24, 2013
Messages
39
Office Version
  1. 2013
Hi
I need to accept a number to cell A1 & insert that number of rows to a set of data already typed

need to extend this feature to all the cells in that row

Assume I have already entered data for rows 2 - 20 & when I enter 3 in cell A1 it should insert 3 new blank rows before row 2. & another number in A3 again it should enter that many rows starting from A4 Need a simple macro to do this
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
A1:
Code:
Sub Insertrows1()Dim i As Long


i = Range("A1") + 1


    Rows("2:" & i).Insert
  
End Sub
A3:
Code:
Sub Insertrows2()
Dim i As Long


i = Range("A3") + 3


    Rows("4:" & i).Insert
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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