copy selection and paste to end of row if 4 criteria are met

Youngdand

Board Regular
Joined
Sep 29, 2017
Messages
123
Hi,

I am struggling with the below problem.

I have a set of data which is 18 columns long and could have many rows.

the data may have many similar items.

For each item where columns a,d,g,h,i,j,k,l,m match another row within the sheet, i need to cut the range a to r to the end of the row containing the first instance, and subsequent matches should be pasted again to the end of this row and so on. below is a small example of the data.

for example row 2 should be pasted to the end of row 1. row 7 should be added to the end of row 6, and row 8 should be added at the end of this.


Can anyone help with this?


AB
CDEFGHIJKLMNOPQR
Company 1AB64VBAName 1Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 1AB64VBAName 1Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 2AB64VBAName 1Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 2BC17CLJName 2Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 2BC17CLJ
Name 2DiffAdd1
DiffAdd2DiffAdd3DiffAdd4DiffAdd5DiffPcodeSome infoMore info
Company 3DE57ZTDName 3Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 3DE57ZTD
Name 3Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 3
DE57ZTD

<tbody>
</tbody>
Name 3
Add1Add2Add3Add4Add5PcodeSome infoMore info
Company 4EF57ZBCName 4Add1Add2Add3Add4Add5PcodeSome infoMore info

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"]123456[/TD]
[TD="align: right"]987654[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]27/06/2017[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]25/07/2017[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]234567[/TD]
[TD="align: right"]876543[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]26/06/2017[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]24/07/2017[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]345678[/TD]
[TD="align: right"]765432[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]06/07/2017[/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]03/08/2017[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]456789[/TD]
[TD="align: right"]654321[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]05/07/2017[/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]02/08/2017[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]567890[/TD]
[TD="align: right"]543210
[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]29/06/2017[/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]27/07/2017[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]678901[/TD]
[TD="align: right"]432109[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]07/07/2017[/TD]
[TD="align: right"]135[/TD]
[TD="align: right"]04/08/2017[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"]789012[/TD]
[TD="align: right"]321098
[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]13/06/2017[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]11/07/2017[/TD]

[TD="align: center"]8
[/TD]

[TD="align: right"]890123
[/TD]
[TD="align: right"]210987[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]03/08/2017[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]31/08/2017[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"]901234
[/TD]
[TD="align: right"]109876[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]06/06/2017[/TD]
[TD="align: right"]160[/TD]
[TD="align: right"]04/07/2017[/TD]

</tbody>
Sheet1
 
HI Fluff,

In the end it threw an Run-time error -2147417878(80010108)
Automation Error
The Object Invoked had disconnected from its clients.

Any idea why this maybe? For reference i am using Excel 2016 64bit
 
Last edited:
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Just tested on ~4500 & it took under a minute. Do you have any event code that might be interfering?
I've no idea why you'd get that error, unless there is something else going on in the background.
 
Upvote 0
Just tested on ~4500 & it took under a minute. Do you have any event code that might be interfering?
I've no idea why you'd get that error, unless there is something else going on in the background.

After a restart and copying the data to a new workbook, it worked flawlessly and fast. Not sure which fixed it, but it works perfectly.

Thanks a million.
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,918
Messages
6,175,365
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top