Trying to Make a macro to compare/copy/write between workbooks

DrParmeJohnson

New Member
Joined
Feb 28, 2019
Messages
44
Hello,
I am relatively new to VBA and so this kind of macro is a bit over my head. Any help is appreciated.

I am trying to make a macro that is executed in my active workbook that looks at another workbook which contains two columns of information. The macro then would look at a cell of a specified and named column and then compare that cell with a column of the same name on the other workbook. If it finds a cell that matches, it will take the value in the next column over and paste that value in a new column that will come after the predefined column it searched in originally and then repeat this process until the entire column has been matched to their corresponding values. The idea is to match up one company's product code (ASIN) with another company's product code (Item#) that correlates to the same product. Also, the column in which the ASIN value comes, may vary between different workbooks.

I know this is a lot but, it would help me greatly as I have no real idea of how to make this come to life.

Thanks again.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I looked at this question several days ago. But I normally do not try to help when there are no specifics.

Like you said:
that looks at another workbook
?? What is the name of the other workbook and look on what sheet.


You said:
which contains two columns of information

?? What two columns you need to say like columns 4 and 6

You said:
The macro then would look at a cell of a specified and named column
What is the name of this specified column?? And by named column how did you name the column?


And on and on.

Maybe if you will provide specifics like this someone here may be able to help you.
<strike>
</strike>

 
Upvote 0
Alright, I'm a bit new to the thread so I tried to be general to make understanding easier. I'll elaborate more on the points you provided.

The name of the other workbook is "ASIN to LD.xlsx"

The two columns are columns A and B and A1 has "ASIN" in it and B1 has "Item#" in it.

And when I say named, I really meant that, like I said prior, the first cell of the two columns has "ASIN" and "Item#" in the first cell.

So, to reiterate with detail in mind, the macro would function as such:

First you would run it on the active workbook (the name varies as it changes depending on where it comes from), where it would find the column with ASIN in the first cell. It would then look at the each cell of this column and for each cell, there is an "ASIN" in each cell that corresponds to a particular item. So, then the macro would look to the other workbook (ASIN to LD.xlsx) on sheet1 (named Sheet1), and search through column A, aka ASIN, until it finds the ASIN value from the active workbook that contains a matching ASIN on the second workbook. Then, when it finds that ASIN, it would look at the cell directly to the right of it in the B column (Item#) and copy that value to a new column that would first need to be placed directly to the right of it (say it were column G, insert a new column H with H1 as "Item#") and then take that value and paste it into, say the initial ASIN was in G2, paste the found Item# into H2 and then repeat this process until there are no more ASIN's in the active workbook remaining to be found.

I hope this clears up most of the confusion, please reply with any questions.

Thanks
 
Upvote 0
alright, i'm a bit new to the thread so i tried to be general to make understanding easier. I'll elaborate more on the points you provided.

The name of the other workbook is "asin to ld.xlsx"

the two columns are columns a and b and a1 has "asin" in it and b1 has "item#" in it.

And when i say named, i really meant that, like i said prior, the first cell of the two columns has "asin" and "item#" in the first cell.

So, to reiterate with detail in mind, the macro would function as such:

First you would run it on the active workbook (the name varies as it changes depending on where it comes from), where it would find the column with asin in the first cell. It would then look at the each cell of this column and for each cell, there is an "asin" in each cell that corresponds to a particular item. So, then the macro would look to the other workbook (asin to ld.xlsx) on sheet1 (named sheet1), and search through column a, aka asin, until it finds the asin value from the active workbook that contains a matching asin on the second workbook. Then, when it finds that asin, it would look at the cell directly to the right of it in the b column (item#) and copy that value to a new column that would first need to be placed directly to the right of it (say it were column g, insert a new column h with h1 as "item#") and then take that value and paste it into, say the initial asin was in g2, paste the found item# into h2 and then repeat this process until there are no more asin's in the active workbook remaining to be found.

I hope this clears up most of the confusion, please reply with any questions.

Thanks
updated info bump
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,793
Members
449,048
Latest member
greyangel23

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