VBA MAcro for integrating one dokument in another

Sara85

New Member
Joined
Nov 4, 2009
Messages
2
Hello,

I'm a beginner in the VBA jungle, I really need help!
I have one workbook containing customer namnes, customer codes and more. The other workbook containes the same names but different information. What I whant to do is to take the information from the second workbook and integrate that in the first workbook. I´ll show you with a small examle:

Workbook1:
Customer Names Year of birth Country
Sara 1978 US
Charlie 1982 Canada
Julie 1986 Poland

Workbook2:
Customer Name Zipcode
Sara 89652
Julie 89523

The result should look like this:
Customer Names Year of birth Country Zipcode
Sara 1978 US 89652
Charlie 1982 Canada No data
Julie 1986 Poland 89523
 

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
1,003
You don't need VBA - just a slightly complicated formula. HLOOKUPS etc should be avoided as they need data in order.

Assuming they start at $A$2 with titles in row 1:

In Workbook 1, in the Zipcode column, put this:
=OFFSET('workbook2'!$B$1,MATCH($A2,'workbook2'!$A:$A,0),0)
 

Sara85

New Member
Joined
Nov 4, 2009
Messages
2
Thank you for your time!

But it doesen't work, some of the names are not spelled exactly the same. Can I use vlookup or something else?

BR
 

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
1,003
If the names aren't spelt the same, a VLOOKUP wouldn't work either.

The only way will be to use the INDEX function, where you have a column where you can type in the row of the name in the second sheet. But if you've 10,000 rows that's probably not feasible!
 

Forum statistics

Threads
1,082,576
Messages
5,366,419
Members
400,888
Latest member
Cdim7

Some videos you may like

This Week's Hot Topics

Top