Solved

Vlookup error

Posted on 2012-03-27
5
304 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 33

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 10

Expert Comment

by:JEaston
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

749 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