View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Fikaman Fikaman is offline
external usenet poster
 
Posts: 1
Default VLOOKUP with two Workbooks

Hello,

I have two workbooks. On "list.xls" I have a spare parts list, and I want to
search for different items form another workbook (Search.xls) using VLOOKUP
in VBA.

Actually I have this code in "search.xls", but I get "Syntax error":


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim Result As Variant

Result =
Application.vlookup(Range("A1"),'D:\[list.xls]Sheet1!$A$1:$D$1999,2,0)
If IsError(Result) Then
Result = 0
End If

cell(B1) = Result
End Sub




Any help is greatly appreciated.

Erik