Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VLOOKUP with two Workbooks

For this kind of thing to work, List.xls will have to be open.

Another option is to plop the formula into an unused cell, then grab the value
from that cell, then clean up that cell.

Is there a reason why you just don't use a formula in the cell to start?

Fikaman wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
vlookup using different workbooks sam Excel Discussion (Misc queries) 4 October 2nd 09 02:15 AM
Vlookup across workbooks tiptoe Excel Programming 2 February 11th 08 07:59 PM
VLookup across Workbooks? PH NEWS Excel Worksheet Functions 0 April 24th 06 03:43 PM
Help with Vlookup to several workbooks Les Stout[_2_] Excel Programming 3 November 2nd 05 07:45 PM
Vlookup between two workbooks kalz Excel Worksheet Functions 1 December 7th 04 10:35 AM


All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"