Solved

Vlookup error

Posted on 2012-03-27
5
305 Views
Last Modified: 2012-03-27
Hi,

Im getting a syntax error on the below lookup i have created

Can anyone advise why this is so?

Thanks
Seamus





Function test()
Dim Res As Variant
Dim r As Long

r = ActiveCell

Res = Application.WorksheetFunction.VLookup(r,Phoenix Pivot!',A:A,1, 0)


End Function
0
Comment
Question by:Seamus2626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:Runrigger
ID: 37771696
Phoenix Pivot!',A:A

should be

'Phoenix Pivot'!A:A
0
 

Author Comment

by:Seamus2626
ID: 37771764
Still getting a Syntax error

Seamus

Function test()
Dim Res As Variant
Dim r As Long

r = ActiveCell

Res = Application.WorksheetFunction.VLookup(r,'Phoenix Pivot'!A:A,1, 0)


End Function
0
 
LVL 34

Accepted Solution

by:
Norie earned 500 total points
ID: 37771786
Try this.
Res = Application.WorksheetFunction.VLookup(r.Value,Worsheets("Phoenix Pivot").Range("A:A"),1, 0)

Open in new window

0
 
LVL 11

Expert Comment

by:John Easton
ID: 37771788
The bit A:A,1 will generate an error.  Normally you would have a cell reference, e.g:  A1:A10.
0
 

Author Closing Comment

by:Seamus2626
ID: 37771833
Thats the one,

Thanks
Seamus
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question