#1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 11
Default VLookUp.

Hi ...

Yesterday I posted a question about deleting selected columns from a
table of data. I was surprised and grateful to receive several responses
complete with code in only a few hours. I chose to use the macro from Rob
Van Gelder because I could follow it better than the others.

Today I have another question, about VLookUp. I've read the help file
carefully, and it sure seems like this should work:

Sub FLook()
Worksheets(1).Cells(2, 2) = Application.WorksheetFunction _
.VLookup(Worksheets(1).Cells(5, 2), "F5:F16", 1, False)
End Sub

It should check the data in cell 5, 2 (which is really B5) and see if
there's a match in range F5:F16. If there's a match, it should copy it to
cell 2, 2. If not it should put #N/A in cell 2, 2. Get message, `Unable to
get the VLookUp property of the worksheet function class.'

Maybe I don't understand the use of VLookUp??

Sam
--
A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VLookUp.

Your understanding of VLookup looks ok.

Instead of "F5:F16", try Range("F5:F16")


"Sam" wrote in message
link.net...
Hi ...

Yesterday I posted a question about deleting selected columns from a
table of data. I was surprised and grateful to receive several responses
complete with code in only a few hours. I chose to use the macro from Rob
Van Gelder because I could follow it better than the others.

Today I have another question, about VLookUp. I've read the help file
carefully, and it sure seems like this should work:

Sub FLook()
Worksheets(1).Cells(2, 2) = Application.WorksheetFunction _
.VLookup(Worksheets(1).Cells(5, 2), "F5:F16", 1, False)
End Sub

It should check the data in cell 5, 2 (which is really B5) and see if
there's a match in range F5:F16. If there's a match, it should copy it to
cell 2, 2. If not it should put #N/A in cell 2, 2. Get message, `Unable to
get the VLookUp property of the worksheet function class.'

Maybe I don't understand the use of VLookUp??

Sam
--
A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default VLookUp.

Sub FLook()
With Worksheets(1)
.Cells(2, 2) = Application.VLookup(.Cells(5, 2), .Range("F5:F16"), 1,
False)
End With
End Sub


"Sam" wrote in message
link.net...
Hi ...

Yesterday I posted a question about deleting selected columns from a
table of data. I was surprised and grateful to receive several responses
complete with code in only a few hours. I chose to use the macro from Rob
Van Gelder because I could follow it better than the others.

Today I have another question, about VLookUp. I've read the help file
carefully, and it sure seems like this should work:

Sub FLook()
Worksheets(1).Cells(2, 2) = Application.WorksheetFunction _
.VLookup(Worksheets(1).Cells(5, 2), "F5:F16", 1, False)
End Sub

It should check the data in cell 5, 2 (which is really B5) and see if
there's a match in range F5:F16. If there's a match, it should copy it to
cell 2, 2. If not it should put #N/A in cell 2, 2. Get message, `Unable to
get the VLookUp property of the worksheet function class.'

Maybe I don't understand the use of VLookUp??

Sam
--
A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default VLookUp.

as the others stated, you need to let it know it is a range, but you may
also need to let it know which sheet the range is in, like if you have an
entire, seperate sheet devoted to lookup ranges ("lookup sheet"). you can
also name the range(s):
application.vlookup(sheets(1).cells(5,2),sheets("l ookup
sheet").range("f5:f16"),1,false)
mike allen

"Sam" wrote in message
link.net...
Hi ...

Yesterday I posted a question about deleting selected columns from a
table of data. I was surprised and grateful to receive several responses
complete with code in only a few hours. I chose to use the macro from Rob
Van Gelder because I could follow it better than the others.

Today I have another question, about VLookUp. I've read the help file
carefully, and it sure seems like this should work:

Sub FLook()
Worksheets(1).Cells(2, 2) = Application.WorksheetFunction _
.VLookup(Worksheets(1).Cells(5, 2), "F5:F16", 1, False)
End Sub

It should check the data in cell 5, 2 (which is really B5) and see if
there's a match in range F5:F16. If there's a match, it should copy it to
cell 2, 2. If not it should put #N/A in cell 2, 2. Get message, `Unable to
get the VLookUp property of the worksheet function class.'

Maybe I don't understand the use of VLookUp??

Sam
--
A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default VLookUp.

..

"mike allen" wrote in message
...
as the others stated, you need to let it know it is a range, but you may
also need to let it know which sheet the range is in, like if you have an
entire, seperate sheet devoted to lookup ranges ("lookup sheet"). you can
also name the range(s):
application.vlookup(sheets(1).cells(5,2),sheets("l ookup
sheet").range("f5:f16"),1,false)
mike allen

"Sam" wrote in message
link.net...
Hi ...

Yesterday I posted a question about deleting selected columns from

a
table of data. I was surprised and grateful to receive several responses
complete with code in only a few hours. I chose to use the macro from

Rob
Van Gelder because I could follow it better than the others.

Today I have another question, about VLookUp. I've read the help

file
carefully, and it sure seems like this should work:

Sub FLook()
Worksheets(1).Cells(2, 2) = Application.WorksheetFunction _
.VLookup(Worksheets(1).Cells(5, 2), "F5:F16", 1, False)
End Sub

It should check the data in cell 5, 2 (which is really B5) and see if
there's a match in range F5:F16. If there's a match, it should copy it

to
cell 2, 2. If not it should put #N/A in cell 2, 2. Get message, `Unable

to
get the VLookUp property of the worksheet function class.'

Maybe I don't understand the use of VLookUp??

Sam
--
A man who had lately declared
That property ought to be shared,
Thought it going too far
When they called for his car,
And a list of exceptions prepared.

Thomas Thorneley,
From The Penguin
Book Of Limericks






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
If (Vlookup 0) working, but what if Vlookup cell does not exist Steve Excel Worksheet Functions 18 November 18th 09 07:33 PM
VLookUp - Does the VLookUp return the exact information? Cpviv Excel Worksheet Functions 2 October 28th 08 09:57 AM
Vlookup in vlookup - taking the result as array name SupperDuck Excel Worksheet Functions 2 June 2nd 07 11:05 AM
Vlookup -=VLOOKUP(F9,LookUp1!$A$2:$B$1504,2,FALSE) MikeR-Oz New Users to Excel 1 March 22nd 06 09:01 AM
Vlookup info being used without vlookup table attached? Excel Worksheet Functions 0 January 25th 05 10:43 AM


All times are GMT +1. The time now is 02:30 AM.

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

About Us

"It's about Microsoft Excel"