insert 'x' number of rows???

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

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!!
 
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
 
Back
Top