Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AK AK is offline
external usenet poster
 
Posts: 56
Default VLOOKUP function in VB

May I know what should be written in the VB script if I want to use VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VLOOKUP function in VB

With worksheets("SheetA")
.Cells(1,2).Value =
Application.Vlookup(.Cells(1,1),Worksheets("SheetB ").Range("A1:C100"),3,False)
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ak" wrote in message
...
May I know what should be written in the VB script if I want to use
VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.



  #3   Report Post  
Posted to microsoft.public.excel.programming
AK AK is offline
external usenet poster
 
Posts: 56
Default VLOOKUP function in VB

Thanks Bob.
But how can I refer Sheet B if this is a worksheet(ex. source) in an
external excel file that I don't want to open it.



"Bob Phillips" wrote:

With worksheets("SheetA")
.Cells(1,2).Value =
Application.Vlookup(.Cells(1,1),Worksheets("SheetB ").Range("A1:C100"),3,False)
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ak" wrote in message
...
May I know what should be written in the VB script if I want to use
VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VLOOKUP function in VB

If you don't want to open that other file, you could:

Find an empty cell
plop the formula in that cell
pick up the result of the calculation
clean up that cell

ak wrote:

Thanks Bob.
But how can I refer Sheet B if this is a worksheet(ex. source) in an
external excel file that I don't want to open it.

"Bob Phillips" wrote:

With worksheets("SheetA")
.Cells(1,2).Value =
Application.Vlookup(.Cells(1,1),Worksheets("SheetB ").Range("A1:C100"),3,False)
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ak" wrote in message
...
May I know what should be written in the VB script if I want to use
VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.





--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VLOOKUP function in VB

In fact, I'd recommend that you open that other workbook, create the =vlookup()
formula and then close that workbook.

Then duplicate that syntax in your code.

Dave Peterson wrote:

If you don't want to open that other file, you could:

Find an empty cell
plop the formula in that cell
pick up the result of the calculation
clean up that cell

ak wrote:

Thanks Bob.
But how can I refer Sheet B if this is a worksheet(ex. source) in an
external excel file that I don't want to open it.

"Bob Phillips" wrote:

With worksheets("SheetA")
.Cells(1,2).Value =
Application.Vlookup(.Cells(1,1),Worksheets("SheetB ").Range("A1:C100"),3,False)
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ak" wrote in message
...
May I know what should be written in the VB script if I want to use
VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.




--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
AK AK is offline
external usenet poster
 
Posts: 56
Default VLOOKUP function in VB

Thanks.

"Dave Peterson" wrote:

In fact, I'd recommend that you open that other workbook, create the =vlookup()
formula and then close that workbook.

Then duplicate that syntax in your code.

Dave Peterson wrote:

If you don't want to open that other file, you could:

Find an empty cell
plop the formula in that cell
pick up the result of the calculation
clean up that cell

ak wrote:

Thanks Bob.
But how can I refer Sheet B if this is a worksheet(ex. source) in an
external excel file that I don't want to open it.

"Bob Phillips" wrote:

With worksheets("SheetA")
.Cells(1,2).Value =
Application.Vlookup(.Cells(1,1),Worksheets("SheetB ").Range("A1:C100"),3,False)
End With

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ak" wrote in message
...
May I know what should be written in the VB script if I want to use
VLOOKUP
function to search details from an external file.
For example,
Cells(1,1) in SheetA contains the Customer#
SheetB contains the Customer#, Customer Address, Contact

cells(1,2) in SheetA will show the corresponding Contact from SheetB after
the VLOOKUP.

Thanks in advance to the expert.




--

Dave Peterson


--

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
How to combine Combo Box function with Vlookup function KH Excel Worksheet Functions 2 April 5th 10 01:24 PM
Combine VLOOKUP and IF function so #NA isn't returned as a value from VLOOKUP buffgirl71 Excel Discussion (Misc queries) 12 November 14th 06 11:36 PM
HOW DO I NEST THE VLOOKUP FUNCTION WITH THE LEFT FUNCTION CHAIM Excel Worksheet Functions 1 July 27th 05 09:10 PM
how do I write a vlookup function within an iserror function so t. JBLeeds Excel Worksheet Functions 2 March 16th 05 10:30 AM
I want to use Vlookup function and AND function in a single formu. prakash Excel Worksheet Functions 3 January 25th 05 07:11 AM


All times are GMT +1. The time now is 09:00 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"