Solved

Vlookup error

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows 7 Share with concurrent edits(Excel) 3 33
Excel 2016 Not Responding Issues 6 28
Mac Excel column treating text as date 2 31
Sum iF  based on a null cell 11 29
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now