Inserting Rows with Input Box selection

rubic

Active Member
Joined
Jul 9, 2008
Messages
251
Hi,

Earlier today I posted a question on deleting empty rows within the selection via an input box and thankfully I got the answer I want within a very short time.
Now the question I have is, instead of deleting of empty rows, I want to insert blank row or rows via an input boxes selection. What the macro need to do is is ask for the range to insert the empty row and after selection of the range via the input box will then ask for the number of rows to insert within the selected range.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try:
Code:
Sub Macro1()
Dim msg As String
msg = InputBox("Please enter the range and rows count to insert rows", "Info", "A7 12")
Range(Split(msg)(0)).Resize(Split(msg)(1), 256).Insert Shift:=xlDown
End Sub

Regards
Northwolves
 
Upvote 0
Northwolves,

Thanks for the quick reply. I ran the macro and this is what I encountered. The input box did not allow me to use the mouse to select a range. I then manually key in the range I wanted to insert, I encountered some form of error message.
I wonder do the codes allows to input the number of rows to insert?
 
Upvote 0

Forum statistics

Threads
1,214,798
Messages
6,121,636
Members
449,043
Latest member
farhansadik

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