ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and Paste in steps (https://www.excelbanter.com/excel-programming/377601-copy-paste-steps.html)

[email protected][_2_]

Copy and Paste in steps
 
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.


Don Guillett

Copy and Paste in steps
 
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
--
Don Guillett
SalesAid Software

wrote in message
ups.com...
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.





All times are GMT +1. The time now is 08:07 PM.

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