VBA to match data, then copy

joelle

New Member
Joined
Apr 13, 2007
Messages
12
Hello Experts,

I hope someone could help me with some vba code for the following:

I have 2 worksheets: sheet-A and sheet-B.
Please how do I:

1. match the part# from sheetA (col B) with part# from sheetB (col A), then
2. if a matching part# is found, copy the qty of the matched part# from sheetA to the qty field of the matching part# in sheet-A.
3. Do loop

I really want to attach an img (I did this before) but now I dont seem to see how. I do not have an URL ??

Many many thanks in advance.

J.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
2. if a matching part# is found, copy the qty of the matched part# from sheetA to the qty field of the matching part# in sheet-A.

1) which column is "qty" on SheetA ?
2) which column to paste on SheetB ?
3) Is sheet name SheetA of Sheet-A ?

4) have you tried VLookUp function ? (w/o vba)

You need to be clear.
 
Upvote 0
Hello Jindon,

First, thank you so much for looking at my post (thought it had died in cold water).

I did try to illustrate what I want to do but without being able to upload an img, its hard. I will try to re-elaborate the point here:
(also, I dont have the option of doing vlookup! because the qty field in sheetA
has merged cells !!!)


sheetB (customer PO):
Part# Qty
------- ----
xxx205 5
xxx104 11
xxx106 4
xxx118 4


sheetA (before macro is run):
Part# Qty
------- ----
xxx104 [blank]
xxx106 [blank]
xxx101 [blank]


sheetA (after macro is run):
Part# Qty
------- ----
xxx104 11
xxx106 4
xxx101 [still blank, no match from sheetB]

As you can see, if macro can match up the part# from sheetB with the part# in sheetA, only then, macro will copy the [qty from B] to the [qty in A] with respect to the matching part#. Here, we have 2 instances, the qty of xxx104 and xxx106 from sheetB is copied to the qty of xxx104 and xxx106 in sheetA. Pls note direction: sheetB ---> sheetA.

It would just be wonderful to know if vba can do this magic!
I'm still holding hope !!! btw, would someone tell me how to attach a .gif img??? thanks.

joelle
 
Upvote 0
Firefytr,

Sorry, I should have mentioned that I crossposted.
Yes, normally I did not do crosspost. But I'm under time pressure and I do not have much luck on the other forum. I just would like to get more inputs to solving the problem.

:cry:
 
Upvote 0
(also, I dont have the option of doing vlookup! because the qty field in sheetA
has merged cells !!!)
Hummm...
Too hard to imagine without seeing your sheet.
Why merged, anyway ?
 
Upvote 0

Forum statistics

Threads
1,215,503
Messages
6,125,175
Members
449,212
Latest member
kenmaldonado

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