View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default merge sheets based on common id with VBA

Use the Vlookup worksheet function in column C of Sheet2. You can replace
the formula with its results after.

With worksheets("Sheet2").Range("C2:C500")
.Formula = "=Vlookup(A2,Sheet1!A:B,2,False)"
.formula = .Value
End With

--
Regards,
Tom Ogilvy


"ulfb" wrote:

Hi
I need to loop throu Sheet1, read id in col A and mydata in col B - find the
matching id in Sheet2 col A and copy mydata into col C of Sheet2.
Sheet1 has few rows, Sheet2 many
Any help much appreciated!
Ulf