Alternative to Vlookup using macros

Kemidan2014

Board Regular
Joined
Apr 4, 2022
Messages
229
Office Version
  1. 365
Platform
  1. Windows
I am hoping this wonderful community can help me once again! with one problem of using Copy paste to paste on criteria from one work sheet another has been solved. i found that becuase my SOURCE worksheet for this task is 1000+ rows and 22 columns of Vlookups referencing a master file who will be overwritten as needed based on information we get from customers. This is causing a very long processing time for the newly added copy paste macro to work. i have found that if my Sheet 1 source data is just text it works INSTANTLY.

my solution needs to be my source sheet also needs to be a copy pasted data from our Masterfile instead of Vlookups. and as it wont be as easy as using the same macro.

I want to copy and paste all rows of data from my master file but i want to EXCLUDE certain columns because this information is irrelevent.

Source: Master file has headers in Row 1, 39 Columns and then Data below that about 1000+ rows of it and grows over time
Destination: Current working file "Sheet1" Same headers in Row 1 but only 23 of the columns of information that we want in this sheet

how would i target in VBA to only copy those specified columns and give me all the corresponding information below that column.

heres headers from source file

ToyotaData.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAM
1QIMS#Doc TypeInstance Handle KeyRankSupplier CodeTMMC Supplier CodeSupplier NamePart NamePart NumberOverall StatusNCD DescriptionQENameFull NameFull NameModelSQA RankLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateOccurenceWhere NC found?Will Parts Be Quarantined ?Why Made CategoryWhy Shipped CategoryNAMCST/CM StatusLT/CM StatusStandardActualAssigned To
Data


heres what i want to get to

Customer database test 2.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1QIMS#Doc TypeRankSupplier CodePart NamePart NumberOverall StatusNCD DescriptionModelLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateNAMC
Sheet1


I apologize but due to nature of the info i cant publically share it. just assume there 1000+ rows of data in each cell below up and that will grow over time so lastrow will always be different.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I want to copy and paste all rows of data from my master file but i want to EXCLUDE certain columns because this information is irrelevent.
You only need to pass the data from book1 from sheet "data" to book 2 on "sheet1"

The sheet1 is empty or should the data go to the next available row?
 
Upvote 0
In column A "QIMS#" of sheet1, do you have data and based on that data you want to get the information from the master book?
 
Upvote 0
In column A "QIMS#" of sheet1, do you have data and based on that data you want to get the information from the master book?
To answer your first question let me give you some more back ground on the master file that we download from our customers website in order to get the latest complaints.
The data under the headers has no order. so the new information could suddenly appear in the middle of spreadsheet.
So to combat that i would like to simply replace the old information book 2 Sheet1 with Book 1 sheet1 but with the limited columns UNLESS there's truely is a magical way it can still acquire the new info since Dates are involved please share!

Column A QIMS# would not have data until it is copied from Master file (book1) Sheet Data

I actually worked out a macro that will copy the whole sheet but it opens the book, copies, but then stops because i have to answer question about clip board memory. pastes and overwrites all information then it closes the master book and saves the file i pasted in. its the stopping to have to answer a question i dont like i was hoping to do stuff in the background with simple macro that i could assign to a button.
 
Upvote 0
I'm lost. Help me with real names of books and sheets. Continuing with your example, you want to copy the data from the book "ToyotaData.xlsx", sheet "Data" and paste in the book "Customer database test 2.xlsm", sheet "Sheet1".

I don't understand why you mention the Vlookup function, what are you looking for?
Now you mention the dates...

It would help if you put an example with generic data on each sheet, before and after. Just put 2 records with general data for me to understand.

I have more doubts, but if you give an example with the before and after, I think with that I would understand.
 
Upvote 0
Here is an example of the Before Data in its which is my Source work book

ToyotaData.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAM
1QIMS#Doc TypeInstance Handle KeyRankSupplier CodeTMMC Supplier CodeSupplier NamePart NamePart NumberOverall StatusNCD DescriptionQENameFull NameFull NameModelSQA RankLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateOccurenceWhere NC found?Will Parts Be Quarantined ?Why Made CategoryWhy Shipped CategoryNAMCST/CM StatusLT/CM StatusStandardActualAssigned To
201-01016-V6-5000QPRIrrelevent Data 1B0101-6Aisin Automotive Casting - TennesseePart 111111-11111Officially Released, Awaiting LTCM PlanFIT CONDITIONQEAMMgrV65/3/20214/28/2021First TimeGR-KAIfalseCust 1STCM ReceivedGASKET HAS TO BE SEATED ALL THE WAY AROUND, CANNOT BE STICKING UPHEAD COVER GASKET NOT SEATED205519
301-01016-V6-5001QPRIrrelevent Data 2B0101-6Aisin Automotive Casting - TennesseePart 422222-22222LTCM Plan Accepted, Awaiting LTCM ActualLOOSEQEAMMgrV65/3/20214/28/2021First TimeGR-KAIfalseCust 2STCM ReceivedGASKET MUST STAY IN PLACEGASKET OUT OF GROOVE205519
401-01016-V6-5002QPRIrrelevent Data 3C0101-6Aisin Automotive Casting - TennesseePart 333333-33333Closed-CancelledPOPPING / PULLING OUTQEAMMgrV65/3/20214/28/2021First TimeGR-KAItrueCust 2STCM ReceivedGASKET TO BE SEATED AND NOT "OUT" OF THE GASKET GROOVEGASKET IS NOT SEATED WHEN CONVEYANCE IS LOADING THE PART205519
501-01016-V6-5003QPRIrrelevent Data 4B0101-6Aisin Automotive Casting - TennesseePart 244444-44444Closed-CancelledWRONG PARTQEAMMgrV63/8/20223/7/2022First TimeNONCtrueCust 2Awaiting STCMCorrect bolt with 8 markingWrong bolt with no 8 marking205519
Data


Here is example of the data of the after which is in the Destination work book

Customer database test 2.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1QIMS#Doc TypeRankSupplier CodePart NamePart NumberOverall StatusNCD DescriptionModelLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateNAMC
214-01016-TNGA-5000QPRB0101-6Part 111111-11111Officially Released, Awaiting LTCM PlanEXCESS MATERIALTNGA4/12/20223/23/20223/28/2022Cust 1
301-01016-V6-5001QIRB0101-6Part 422222-22222LTCM Plan Accepted, Awaiting LTCM ActualADHESIVE NGV64/7/20224/15/20223/22/20223/23/20223/31/20224/4/2022Cust 2
401-01016-V6-5002QPRC0101-6Part 333333-33333Closed-CancelledPOPPING / PULLING OUTV65/3/20214/28/2021Cust 2
501-01016-V6-5003QPRB0101-6Part 244444-44444Closed-CancelledWRONG PARTV63/8/20223/7/2022Cust 2
Sheet1
 
Upvote 0
So to reitterate on my current Destination work book "Customer Database Test - Sheet 1" were all the data from row 2 down to row 2600 is all Vlookups to Source workbook "Toyotadata - Data"
and id like to pull the same information i have on customerdatabase Test but not using Vlook ups because of processing time for updating
 
Upvote 0
Your example confuses me. In the destination workbook in the column "QIMS#" you have this data 14-01016-TNGA-5000, but that data is not in the source workbook ...

There are other data that are in the source, which do not appear in the destination.
1649256342130.png


So I still don't understand. If you have 4 records at the source, you should pass 4 records to the destination with all your data. (obviously the required columns, that part I already understood), but I do not understand why in the destination there are different data.

It is necessary that you put the destination sheet twice, once with the data before any execution, and the second with the expected result.

That is, I need to see 3 sheets, the source sheet, the destination sheet before execution and the same destination sheet with the expected results.
 
Last edited:
Upvote 0
Ok i apologize on confusing you, i alterred some of the data for privacy reasons but forgot to copy some of the dates over so i will repost but ensure all cells are test data is correct for you.

here is SOURCE sheet
ToyotaData2.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAM
1QIMS#Doc TypeInstance Handle KeyRankSupplier CodeTMMC Supplier CodeSupplier NamePart NamePart NumberOverall StatusNCD DescriptionQENameFull NameFull NameModelSQA RankLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateOccurenceWhere NC found?Will Parts Be Quarantined ?Why Made CategoryWhy Shipped CategoryNAMCST/CM StatusLT/CM StatusStandardActualAssigned To
201-01016-V6-5000QPRIrrelevent DataB0101-6Aisin Automotive Casting - TennesseePart 111111-11111Closed-CancelledFIT CONDITIONQEAMMGRV65/3/20214/28/2021First TimeGR-KAIfalseCust 1STCM ReceivedGASKET HAS TO BE SEATED ALL THE WAY AROUND, CANNOT BE STICKING UPHEAD COVER GASKET NOT SEATED205519
301-01016-V6-5002QPRIrrelevent DataB0101-6Aisin Automotive Casting - TennesseePart 222222-22222Closed-CancelledLOOSEQEAMMGRV65/3/20214/28/2021First TimeGR-KAIfalseCust 1STCM ReceivedGASKET MUST STAY IN PLACEGASKET OUT OF GROOVE205519
401-01016-V6-5001QPRIrrelevent DataC0101-6Aisin Automotive Casting - TennesseePart 111111-11111Closed-CancelledPOPPING / PULLING OUTQEAMMGRV65/3/20214/28/2021First TimeGR-KAItrueCust 1STCM ReceivedGASKET TO BE SEATED AND NOT "OUT" OF THE GASKET GROOVEGASKET IS NOT SEATED WHEN CONVEYANCE IS LOADING THE PART205519
501-01016-V6-5003QPRIrrelevent DataB0101-6Aisin Automotive Casting - TennesseePart 333333-33333Closed-CancelledWRONG PARTQEAMMGRV63/8/20223/7/2022First TimeNONCtrueCust 1Awaiting STCMCorrect bolt with 8 markingWrong bolt with no 8 marking205519
601-01016-V6-5004QIRIrrelevent DataC0101-6Aisin Automotive Casting - TennesseePart 444444-44444Initial Release - Awaiting STCMDIMENSIONQEAMMGR080Y,417W,434W,502W,511W,512W,537W,541W,567W,574W,4/6/2022RecurrenceAR Upper LinetrueCust 2Parts must meet all specs.Part had scratch on seal surface.
Data



Here is Destination sheet Before Execution
Customer database test 2.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1QIMS#Doc TypeRankSupplier CodePart NamePart NumberOverall StatusNCD DescriptionModelLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateNAMC
201-01016-V6-5000QPRB0101-6Part 111111-11111Closed-CancelledFIT CONDITIONV65/3/20214/28/2021Cust 1
301-01016-V6-5002QPRB0101-6Part 222222-22222Closed-CancelledLOOSEV65/3/20214/28/2021Cust 1
401-01016-V6-5001QPRC0101-6Part 111111-11111Closed-CancelledPOPPING / PULLING OUTV65/3/20214/28/2021Cust 1
501-01016-V6-5003QPRB0101-6Part 333333-33333Closed-CancelledWRONG PARTV63/8/20223/7/2022Cust 1
Sheet1


Here is Destination sheet AFTER execution
Customer database test 2.xlsm
ABCDEFGHIJKLMNOPQRSTUV
1QIMS#Doc TypeRankSupplier CodePart NamePart NumberOverall StatusNCD DescriptionModelLT CM Plan DueOriginal LTCM Actual Due DateRevised LTCM Actual Due DateCloseInitial Issuance DateOfficial Issuance DateLTCM Plan SubmittedLTCM Plan Accepted DateLTCM Plan Rejection DateLTCM Actual SubmittedLTCM Actual Accepted DateLTCMActualRejectionDateNAMC
201-01016-V6-5000QPRB0101-6Part 111111-11111Closed-CancelledFIT CONDITIONV65/3/20214/28/2021Cust 1
301-01016-V6-5002QPRB0101-6Part 222222-22222Closed-CancelledLOOSEV65/3/20214/28/2021Cust 1
401-01016-V6-5001QPRC0101-6Part 111111-11111Closed-CancelledPOPPING / PULLING OUTV65/3/20214/28/2021Cust 1
501-01016-V6-5003QPRB0101-6Part 333333-33333Closed-CancelledWRONG PARTV63/8/20223/7/2022Cust 1
601-01016-V6-5004QIRC0101-6Part 444444-44444Initial Release - Awaiting STCMDIMENSIONI44/6/2022Cust 2
Sheet1
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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