VBA - Find match from another workbook, with multiple criterias, and paste in first awailable row

Engalpengal

New Member
Joined
May 10, 2023
Messages
43
Office Version
  1. 365
Platform
  1. Windows
Hello again
First of all, I want to use this opportunity to thank you all here Mr. Excel for the help I have received from you in previous posts.
The work you have put in to it has been invaluable.
I have learned so much, but still have a lot more left to learn
My main goal is to make a process planning system

So the next obstacle is marked in blue:
Sub Copy_ord_fromPL()

Dim oRdre As Variant
Dim pL As Variant

Dim cR1 As String '-------------------------------------------------- Text only
Dim copyFr As Variant '--------------------------------------------- Numbers and text
Dim pDest As Variant '---------------------------------------------- Numbers and text

Set oRdre = Workbooks("Ordre-Spor.xlsm").Sheets("Ordre") '---- Set Workbook for search area
Set pL = ThisWorkbook.Sheets("Plate_copy.xlsm") '--------------- Set Workbook for paste area

Set cRl = oRdre.Range("AK13:BC5000") '--------------------------- Set area for Criteria
Set copyFr = oRdre.Range("C13:P25000") '------------------------ Set search and copy range/area
Set pDest = pL.Range("C67:P5000") '------------------------------ Set paste range/area

Set mPL = oRdre.Range("AK11:AO11") '-------------------------- Set area for key cells, to match in range "kR1area"

Application.ScreenUpdating = False

Action:
Search in "cR1" for rows that match with info given in "mPL" (minimum one col match)
If true (can be more than one rowmatch), copy value C:P

Paste in area "pDest", first available row

Application.ScreenUpdating = True
End Sub


Explanation pictures

Pic 1 - "oRdre.jpg"
Here is a list of products. Further down the row you will find a "process-descriprion" (see pic 2).

Pic 2 - "cR1-and-mPL.jpg"
Cells AK11:AT11 is a process description
Every product line has a separately process setup
0 means that the product isnt suppose to go through that spesific process, and therefore the product shall not be copied
If the product should go through a sesofic process, the column for that spesific prosess will be marked with the process name. This product must be copied.
If the product has been through that process, the column is marked with a green "v", and therefore the product shall not be copied

Pic 3 - "pL.jpg"
Paste area for products that are ready for process starting with "PL"


Hope that this explanation is understandable and that it is possible to program
 

Attachments

  • oRdre.jpg
    oRdre.jpg
    243.7 KB · Views: 14
  • cR1-and-mPL.jpg
    cR1-and-mPL.jpg
    50.1 KB · Views: 23
  • pL.jpg
    pL.jpg
    130.7 KB · Views: 20
Last edited:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,162
Messages
6,170,432
Members
452,326
Latest member
johnshaji

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