|
Sub Macro1()
'31/12/2003 power by lam
Application.ScreenUpdating = False
Application.EnableCancelKey = xlDisabled
book = Trim(Range("af1").Value)
Sheet = Trim(Range("ag1").Value)
xrow = ActiveSheet.[A65536].End(xlUp).Row
For arow = 5 To xrow
Range("b" & arow).Value = ""
Range("f" & arow).Value = ""
Next
'MsgBox (xrow)
For arow = 5 To xrow
Range("B" & arow).Select
'ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],[Tellist.xls]Tellist!C5:C7,2,FALSE)"
ActiveCell.Formula = "=VLOOKUP(a" & arow & ",[" & book & ".xls]" & Sheet & "!a2:d1700,2,FALSE)"
Range("b" & arow).Value = Range("b" & arow).Text
Range("f" & arow).Select
ActiveCell.Formula = "=VLOOKUP(a" & arow & ",[" & book & ".xls]" & Sheet & "!a2:d1700,4,FALSE)"
Range("f" & arow).Value = Range("f" & arow).Text
Next
MsgBox ("Ok, Update " & xrow & " Record")
End Sub
|
|