Copy a range of cells from worksheet in workbook a to worksheet in workbook b
I have worksheet (part a) in workbook(quote) with 30 rows of data which change with macro execution. I need to copy a range on worksheet (bom-part M) in workbook(master) to last row on worksheet (part a) in workbook(quote) when a Cell value in Q17 to Q40 of worksheet (part a) in workbook(quote) is the name of a worksheet in workbook(master). The variable values in cells Q17 to Q40 may contain one to five names of different worksheet names in workbook(master) from which I need to copy the range of each from onto worksheet (part a).
Example: Q23 of worksheet (part a) in workbook(quote) = to "bom-part M", a sheet name in workbook(master), I want to copy range A16:L40 of worksheet (bom-part M) to last row of worksheet (part a) in workbook(quote). Then
repeat for next matching value, say in Q29 in worksheet (part a) in workbook(quote) = to "bom-part Z", another sheet in workbook(master), I want to copy range A16:L40 of worksheet (bom-part Z) to last row of worksheet (part a) in workbook(quote). Then repeat till no more cells meet matching value.
Would this be a macro, a script or can a formula in worksheet (part a) accomplish this?
Thanks Bill
.
copy cells from one workbook to another
Hi Bill
There are 2 aspects to your question...
I have a few articles for you to read:
http://excelexperts.com/copy-values-vba
and:
http://excelexperts.com/VBA-Tips-Find-The-Last-Cell
Nick
Thanks for reply, but let me refine my question
Hi Nick,
Hope this clarifies, and I look forward to your reply.
Thanks,
Bill
pick up worksheet name
if you have a worksheet name in a cell, and you want to select that worksheet (for example)
Worksheets(Range("Q17")).Select
so if Range("Q17") = "ABC"
sheet "ABC" will be selected
To rename a worksheet:
Worksheets("A").name = "B"
- renames worksheet A to B.. (provided B does not exist already)
worksheet name
What if the worksheet is in a different workbook?
Thanks,
Bill
worksheets in different workbook
workbooks(Range("xxxx")).activate
Worksheets(Range("Q17")).Select