View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default Document merging

Hi Remo,

Try this macro:

Sub StrKeyFill()
sectypewb = InputBox("Please, enter the path and name of the second type
workbook (without extension)!")
Workbooks.Open Filename:=sectypewb & ".xls"
lastrow = Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
Range("D2").Select
ActiveCell.FormulaR1C1 =
"=VLOOKUP(RC[-3],[base.xls]Sheet1!R2C1:R5C2,2,FALSE)"
Selection.AutoFill Destination:=Range("D2:D" & lastrow),
Type:=xlFillDefault
End Sub


It basically does the job, though it can be further refined, e.g. to check
the existence of the second type file, etc.

Regards,
Stefi

€˛Remo Turchetti€¯ ezt Ć*rta:

My problem is simple, but the explanation isnt that much...

I have a document called base.xls, and its composed of two columns. Column A
is the string key, and column B is the string translation.

Now i have a series of other documents that are composed of several columns,
but then again columna A is the string key, and column D is the string
translation.

What i need to do is to create a routine at base.xls that can be used to
compare column A from both documents, and if they match, put on the D cell
of the second kind of document the text that is in the B cell of base.xls

Also, i need to be able to change what document im comparing, because i have
like 5 or 6 of the type 2 documents every week, and all need the string
translation .

Could anyone help me?