ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy to designated sheet based on value in cell (https://www.excelbanter.com/excel-programming/408119-copy-designated-sheet-based-value-cell.html)

JDaywalt

Copy to designated sheet based on value in cell
 
I have two workbooks, let's call them Parent & Child. Parent is the master
template that contains a cross-ref table on sheet tab labeled "Xref" that
shows a long description in column A, and the corresponding sheet tab name in
column B. It also then contains each of the designated sheet tabs. Here is
an example of what the "Xref" tab looks like:
A B
1 This is long description #1 LongDesc1
2 This is long description #2 LongDesc2
3 This is long description #3 LongDesc3

Each of the 'Child' files contains a description on Sheet 1, cell A1 that
corresponds with the long descriptions in the Xref table of the Parent file.
I need to write code (executed from the Parent file), that will go to the
Child file, find the long description from Sheet 1, cell A1, then copy 'all
cells' from Sheet 1 onto the proper sheet tab in the Parent file based upon
the cross-reference table above. Can someone help me with this?


Jarek Kujawa[_2_]

Copy to designated sheet based on value in cell
 
try to select cells in Column A and then:

For Each Cell in Selection
Workbooks("Child").Activate
If Sheet1.Range("A1") = Cell Then
Sheet1.UsedRange.Copy
Workbooks("Parent").Activate
Sheets(Cell.Offset(0,1)).Activate
Cells(1,1).Select
Selection.Paste
End if
Next Cell

HIH

On 21 Mar, 16:24, JDaywalt wrote:
I have two workbooks, let's call them Parent & Child. *Parent is the master
template that contains a cross-ref table on sheet tab labeled "Xref" that
shows a long description in column A, and the corresponding sheet tab name in
column B. *It also then contains each of the designated sheet tabs. *Here is
an example of what the "Xref" tab looks like:
* * * * * * * * * *A * * * * * * * * * * * * * * * * * * B
1 *This is long description #1 * * * *LongDesc1
2 *This is long description #2 * * * *LongDesc2
3 *This is long description #3 * * * *LongDesc3

Each of the 'Child' files contains a description on Sheet 1, cell A1 that
corresponds with the long descriptions in the Xref table of the Parent file. *
I need to write code (executed from the Parent file), that will go to the
Child file, find the long description from Sheet 1, cell A1, then copy 'all
cells' from Sheet 1 onto the proper sheet tab in the Parent file based upon
the cross-reference table above. *Can someone help me with this?




All times are GMT +1. The time now is 08:46 AM.

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