RobertHamberg
New Member
- Joined
- Jan 11, 2018
- Messages
- 34
- Office Version
- 365
I need a script that copy values from Sheet1 to Sheet2.
I need the script to search for matching rows in Sheet1 and Sheet2 based on the values in column A on Sheet1 (Sheet2 will have alot more rows then in this example) and then copy the values on those rows from column F,G and H in Sheet1 to the matching rows on Sheet2 AND on the matching column based on the values in cells F1, G1 and H1 on Sheet1. (These values will change as that are based on the WEEKNUM-function)
Sheet1
[TABLE="class: grid, width: 644"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Owner[/TD]
[TD]Time[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Test6[/TD]
[TD]Resurs 7[/TD]
[TD="align: right"]150[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD]Test7[/TD]
[TD]Resurs 8[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]30[/TD]
[/TR]
</tbody><colgroup><col span="3"><col span="2"><col span="3"></colgroup>[/TABLE]
Sheet2
[TABLE="class: grid, width: 967"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD="align: right"]F[/TD]
[TD="align: right"]G[/TD]
[TD="align: right"]H[/TD]
[TD="align: right"]I[/TD]
[TD="align: right"]J[/TD]
[TD="align: right"]K[/TD]
[TD="align: right"]L[/TD]
[TD="align: right"]M[/TD]
[TD="align: right"]N[/TD]
[TD="align: right"]O[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Owner[/TD]
[TD]Time[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]Test6[/TD]
[TD]Resurs 7[/TD]
[TD="align: right"]150[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Test7[/TD]
[TD]Resurs 8[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col><col><col span="2"><col span="10"></colgroup>[/TABLE]
Thanks in advance!
Robert
I need the script to search for matching rows in Sheet1 and Sheet2 based on the values in column A on Sheet1 (Sheet2 will have alot more rows then in this example) and then copy the values on those rows from column F,G and H in Sheet1 to the matching rows on Sheet2 AND on the matching column based on the values in cells F1, G1 and H1 on Sheet1. (These values will change as that are based on the WEEKNUM-function)
Sheet1
[TABLE="class: grid, width: 644"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Owner[/TD]
[TD]Time[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]Test6[/TD]
[TD]Resurs 7[/TD]
[TD="align: right"]150[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]50[/TD]
[/TR]
[TR]
[TD]Test7[/TD]
[TD]Resurs 8[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD="align: right"]28[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]30[/TD]
[/TR]
</tbody><colgroup><col span="3"><col span="2"><col span="3"></colgroup>[/TABLE]
Sheet2
[TABLE="class: grid, width: 967"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD="align: right"]F[/TD]
[TD="align: right"]G[/TD]
[TD="align: right"]H[/TD]
[TD="align: right"]I[/TD]
[TD="align: right"]J[/TD]
[TD="align: right"]K[/TD]
[TD="align: right"]L[/TD]
[TD="align: right"]M[/TD]
[TD="align: right"]N[/TD]
[TD="align: right"]O[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Owner[/TD]
[TD]Time[/TD]
[TD]Start[/TD]
[TD]End[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]10[/TD]
[/TR]
[TR]
[TD]Test6[/TD]
[TD]Resurs 7[/TD]
[TD="align: right"]150[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Test7[/TD]
[TD]Resurs 8[/TD]
[TD="align: right"]88[/TD]
[TD="align: right"]2018-01-01[/TD]
[TD="align: right"]2018-12-31[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col><col><col span="2"><col span="10"></colgroup>[/TABLE]
Thanks in advance!
Robert