Help Needed to Match Text in Multiple Cells on Two Sheets and if Match Paste in New Sheet

JPatty

New Member
Joined
Sep 21, 2022
Messages
14
Office Version
  1. 365
  2. 2019
  3. 2011
Platform
  1. Windows
Hello, I am still fairly new to VBA and don't have any experience writing code that takes three different sheets into account. So I'm not sure where to begin.

If a cell in col A, sheet "CUST_COLOR" matches a cell in col A, sheet "BLANKET_DATA", then copy the entire row from "BLANKET_DATA" and paste to sheet "IMPORT" starting at A2.
Looping through all cells with text in col A, "CUST_COLOR".
Also, each match between CUST_COLOR and BLANKET_DATA would need to be pasted as many times as there are cells with text in col B in CUST_COLOR. With col B from CUST_COLOR copied to col D&C on IMPORT.
I appreciate any help, thank you.

BLANKET_DATA
IMPORT FILE EXAMPLE.xlsm
ABCDEFGHIJKLM
1COLORTYPECUST ACCTCUST CODECOLOR CODEUsername 1Credential 1Credential 2Credential 3ACCTACCOUNT FLAGPaymentENABLE OVERRIDE
2BlackSTANDARDBLACKSPECIAL12345888888USD
3BlueSTANDARDBLUESPECIAL6789122222777777NoUSDYes
4BrownSTANDARDBROWN444444USDNo
5GraySTANDARDGRAY12345999999USDNo
6GreenSTANDARDGREENSPECIAL12345666666USDNo
7OrangeSTANDARDORANGESPECIAL6789122111111USDNo
8PinkSTANDARDPINK SPECIAL6789133333333333USDNo
9PurpleSTANDARDPURPLESPECIAL67891222222USDNo
10RedSTANDARDRED SPECIAL12345777777USD
11WhiteSTANDARDWHITE555555USD
12YellowSTANDARDYELLOW11111555555USDNo
BLANKET_DATA


CUST_COLOR
IMPORT FILE EXAMPLE.xlsm
ABC
1COLORCUST ACCT
2GreenBusiness1
3YellowBusiness2
4BlueBusiness3
5BlackBusiness4
6RedBusiness5
7OrangeBusiness6
8Pink
9Purple
10
CUST_COLOR


Example of end result IMPORT
IMPORT FILE EXAMPLE.xlsm
ABCDEFGHIJKLMN
1COLORTYPECUST ACCTCUST CODECOLOR CODEUsername 1Credential 1Credential 2Credential 3ACCTACCOUNT FLAGPaymentENABLE OVERRIDE
2GreenSTANDARDBusiness1Business1GREENSPECIAL12345####USDNo
3GreenSTANDARDBusiness2Business2GREENSPECIAL12345####USDNo
4GreenSTANDARDBusiness3Business3GREENSPECIAL12345####USDNo
5GreenSTANDARDBusiness4Business4GREENSPECIAL12345####USDNo
6GreenSTANDARDBusiness5Business5GREENSPECIAL12345####USDNo
7GreenSTANDARDBusiness6Business6GREENSPECIAL12345####USDNo
8YellowSTANDARDBusiness1Business1YELLOW11111####USDNo
9YellowSTANDARDBusiness2Business2YELLOW11111####USDNo
10YellowSTANDARDBusiness3Business3YELLOW11111####USDNo
11YellowSTANDARDBusiness4Business4YELLOW11111####USDNo
12YellowSTANDARDBusiness5Business5YELLOW11111####USDNo
13YellowSTANDARDBusiness6Business6YELLOW11111####USDNo
14BlueSTANDARDBusiness1Business1BLUESPECIAL6789122222####NoUSDYes
15BlueSTANDARDBusiness2Business2BLUESPECIAL6789122222####NoUSDYes
16BlueSTANDARDBusiness3Business3BLUESPECIAL6789122222####NoUSDYes
17BlueSTANDARDBusiness4Business4BLUESPECIAL6789122222####NoUSDYes
18BlueSTANDARDBusiness5Business5BLUESPECIAL6789122222####NoUSDYes
19BlueSTANDARDBusiness6Business6BLUESPECIAL6789122222####NoUSDYes
20BlackSTANDARDBusiness1Business1BLACKSPECIAL12345####USD
21BlackSTANDARDBusiness2Business2BLACKSPECIAL12345####USD
22BlackSTANDARDBusiness3Business3BLACKSPECIAL12345####USD
23BlackSTANDARDBusiness4Business4BLACKSPECIAL12345####USD
24BlackSTANDARDBusiness5Business5BLACKSPECIAL12345####USD
25BlackSTANDARDBusiness6Business6BLACKSPECIAL12345####USD
26RedSTANDARDBusiness1Business1RED SPECIAL12345####USD
27RedSTANDARDBusiness2Business2RED SPECIAL12345####USD
28RedSTANDARDBusiness3Business3RED SPECIAL12345####USD
29RedSTANDARDBusiness4Business4RED SPECIAL12345####USD
30RedSTANDARDBusiness5Business5RED SPECIAL12345####USD
31RedSTANDARDBusiness6Business6RED SPECIAL12345####USD
32OrangeSTANDARDBusiness1Business1ORANGESPECIAL6789122####USDNo
33OrangeSTANDARDBusiness2Business2ORANGESPECIAL6789122####USDNo
34OrangeSTANDARDBusiness3Business3ORANGESPECIAL6789122####USDNo
35OrangeSTANDARDBusiness4Business4ORANGESPECIAL6789122####USDNo
36OrangeSTANDARDBusiness5Business5ORANGESPECIAL6789122####USDNo
37OrangeSTANDARDBusiness6Business6ORANGESPECIAL6789122####USDNo
38PinkSTANDARDBusiness1Business1PINK SPECIAL6789133333####USDNo
39PinkSTANDARDBusiness2Business2PINK SPECIAL6789133333####USDNo
40PinkSTANDARDBusiness3Business3PINK SPECIAL6789133333####USDNo
41PinkSTANDARDBusiness4Business4PINK SPECIAL6789133333####USDNo
42PinkSTANDARDBusiness5Business5PINK SPECIAL6789133333####USDNo
43PinkSTANDARDBusiness6Business6PINK SPECIAL6789133333####USDNo
44PurpleSTANDARDBusiness1Business1PURPLESPECIAL67891####USDNo
45PurpleSTANDARDBusiness2Business2PURPLESPECIAL67891####USDNo
46PurpleSTANDARDBusiness3Business3PURPLESPECIAL67891####USDNo
47PurpleSTANDARDBusiness4Business4PURPLESPECIAL67891####USDNo
48PurpleSTANDARDBusiness5Business5PURPLESPECIAL67891####USDNo
49PurpleSTANDARDBusiness6Business6PURPLESPECIAL67891####USDNo
50
IMPORT
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Power Query solution: Make a connection to BLANKET_DATA. Then a query for CUST_COLOR, merge it with BLANKET_DATA (Left Outer) and expand the table. Load to a new table named IMPORT. No VBA needed in this case.
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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