ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   insert 'x' number of rows??? (https://www.excelbanter.com/excel-programming/285593-insert-x-number-rows.html)

ali

insert 'x' number of rows???
 
Does anyone know a macro that when run will open a box that will reques
the user to enter the number of rows they wish to insert and then, o
clicking ok, the desired number of rows is entered either above o
below the active cell?

I think i spend half my day entering rows so any help will be muc
appreciated!!

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

insert 'x' number of rows???
 
sub Addrows()
num = InputBox("Enter number of rows to insert above active cell")
if num < "" then
if isnumeric(num) then
activeCell.Resize(num).Entirerow.Insert
end if
end if
End sub

You could indicate below the activecell by entering a negative number

sub Addrows()
num = InputBox("Enter number of rows to insert ")
if num < "" then
if isnumeric(num) then
if clng(num) < 0 then
activecell.Offset(1,0).Resize(abs(num)).Entirerow. Insert
else
activeCell.Resize(num).Entirerow.Insert
End if
end if
end if
End sub

--
Regards,
Tom Ogilvy



"ali" wrote in message
...
Does anyone know a macro that when run will open a box that will request
the user to enter the number of rows they wish to insert and then, ok
clicking ok, the desired number of rows is entered either above or
below the active cell?

I think i spend half my day entering rows so any help will be much
appreciated!!!


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 04:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com