P
petee
I have a spreadsheet where I need to copy a row and have EXCEL
automatically copy new rows based on a number inputted by the user
(less 1).
I've used a code which was previously posted that creates a box asking
how many rows I need. This works fine but the problem is that people
often input one row too many
For example: If they need 10 rows overall , they inadvertently input a
10 ... giving a total of 11 rows (the original row + the 10 NEW
rows) )
So I was wondering if anyone would know how to fine tune the code so
that it would give me one less row than what the user inputs.
Here's the code that I use:
Sub copyrows()
numrows = InputBox("Number of rows")
'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows)
Rows(ActiveCell.Row).Copy
ActiveCell.Resize(numrows).Insert
Application.CutCopyMode = False
End Sub
Thanks for any Help
automatically copy new rows based on a number inputted by the user
(less 1).
I've used a code which was previously posted that creates a box asking
how many rows I need. This works fine but the problem is that people
often input one row too many
For example: If they need 10 rows overall , they inadvertently input a
10 ... giving a total of 11 rows (the original row + the 10 NEW
rows) )
So I was wondering if anyone would know how to fine tune the code so
that it would give me one less row than what the user inputs.
Here's the code that I use:
Sub copyrows()
numrows = InputBox("Number of rows")
'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows)
Rows(ActiveCell.Row).Copy
ActiveCell.Resize(numrows).Insert
Application.CutCopyMode = False
End Sub
Thanks for any Help