Copy and Paste in steps

H

haas786

Hey all,

How would I copy a certain amount of rows (customer data info) from a
workbook to paste into a master database based on a cell which
indicates the number of rows?

For example, I have a worksheet with 15 rows of customer data. I just
want to copy 4 rows - (this is based on a cell in A1 signifying I want
only the first 4 rows copied.) Based on that, I'd run a macro which
would copy only those 4 rows (starting from rows 3 to row 6) and paste
them into a master database. The paste will happen at the next row from
the end of the master database.

Thanks for your help in advance.
 
D

Don Guillett

You may like this. Works from the active cell. the ,7 is the number of
columns to the right

Sub copyvarrows()
num = InputBox("Number of rows")
With Sheets("master")
lr = .Cells(.Rows.Count, "a").End(xlUp).Row + 1
ActiveCell.Resize(num, 7).Copy .Rows(lr)
End With
End Sub
 

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