Enter formulas in a certain number of rows, based on a cell value

J

jeffbert

I have a new item worksheet set up, for buyers to properly enter all of the
information needed to set up new sku's in our system. What I would like to
do, is have them enter the number of new items they are setting up, and then
have Excel copy all of the formulas in row 2 and paste them into the exact
number of rows equal to the number of items they are setting up.

Example:

# of sku's being set up = 15
Copy row 2 and paste it into the 15 contiguous rows from 2 thru 14
 
T

Tom Ogilvy

Sub AAA()
Dim num As Variant, rng As Range
num = InputBox("enter number of new rows")
If num = "" Then Exit Sub
If Not IsNumeric(num) Then Exit Sub
Set rng = Cells(Rows.Count, 1).End(xlUp)(2).EntireRow
Set rng = rng.Resize(num)
Rows(2).Copy rng
End Sub
 
J

jeffbert

Works perfectly. Once again, thanks for your help. This is the third or
fourth time that you have come through for me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top