Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default error message in Vlookup

Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default error message in Vlookup

Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default error message in Vlookup

Hi Jill,

You need to use either:

Application.VLookup

or:

Application.WorksheetFunction.VLookup

The first will return an error value if the lookup fails, the second will
generate a VBA error if the lookup fails.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Jill" wrote in message
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default error message in Vlookup

Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im

Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I

missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub


.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default error message in Vlookup

Hi
how is ly defined?

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im Newsbeitrag
...
Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im

Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I

missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub


.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error message in Vlookup

Essentially Vlookup or any other worksheet function used in VBA or used in
VBA with Evaluate will not work with a closed workbook such as you show.
John Walkenbach does document one method that works which uses
ExecuteExcel4Macro, however, this is very slow. It is often easier/faster
to write you formula in a cell, collect the result, clear the cell.

http://j-walk.com/ss/excel/tips/tip82.htm
A VBA Function to Get a Value From a Closed File

--
Regards,
Tom Ogilvy


"Jill" wrote in message
...
Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im

Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I

missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub


.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error message in Vlookup

I guess I should add that Harlan Grove also has a method that opens another
verion of Excel, opens the file and extracts the information, but that
really isn't working on a closed workbook. It is primarily posted as a UDF
method for functions used in worksheets to replace use of the indirect
worksheet function.

Also, Andy Wiggins has a method using sql.request that is supposed to work
and if the data is in a table, it can be accessed using ADO or perhaps the
older DAO.

I believe Frank can post a reference to previous posts on those topics.

--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
Essentially Vlookup or any other worksheet function used in VBA or used in
VBA with Evaluate will not work with a closed workbook such as you show.
John Walkenbach does document one method that works which uses
ExecuteExcel4Macro, however, this is very slow. It is often easier/faster
to write you formula in a cell, collect the result, clear the cell.

http://j-walk.com/ss/excel/tips/tip82.htm
A VBA Function to Get a Value From a Closed File

--
Regards,
Tom Ogilvy


"Jill" wrote in message
...
Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im

Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I

missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub

.





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default error message in Vlookup

[...]
Also, Andy Wiggins has a method using sql.request that is supposed to

work
and if the data is in a table, it can be accessed using ADO or

perhaps the
older DAO.

I believe Frank can post a reference to previous posts on those

topics.

here we go:
http://tinyurl.com/2c62u

Frank

  #9   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default error message in Vlookup

Hi Jill,

I have seen this when the column is of a different data
type (i.e. Number vs Text)...

-----Original Message-----
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I

missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub
.

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default error message in Vlookup

Before Harlan drops by...

His UDF opens another instance of excel, but retrieves that value from a still
closed workbook.

(Yeah, I got corrected.)

Tom Ogilvy wrote:

I guess I should add that Harlan Grove also has a method that opens another
verion of Excel, opens the file and extracts the information, but that
really isn't working on a closed workbook. It is primarily posted as a UDF
method for functions used in worksheets to replace use of the indirect
worksheet function.

Also, Andy Wiggins has a method using sql.request that is supposed to work
and if the data is in a table, it can be accessed using ADO or perhaps the
older DAO.

I believe Frank can post a reference to previous posts on those topics.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Essentially Vlookup or any other worksheet function used in VBA or used in
VBA with Evaluate will not work with a closed workbook such as you show.
John Walkenbach does document one method that works which uses
ExecuteExcel4Macro, however, this is very slow. It is often easier/faster
to write you formula in a cell, collect the result, clear the cell.

http://j-walk.com/ss/excel/tips/tip82.htm
A VBA Function to Get a Value From a Closed File

--
Regards,
Tom Ogilvy


"Jill" wrote in message
...
Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im
Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I
missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub

.




--

Dave Peterson



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default error message in Vlookup

Thanks - guess I haven't looked at it in a while - so I guess he puts a hard
coded reference to the closed workbook in the new instance of excel, gets
the value returned, then closes everything. (and does it invisibly of
course).

--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
Before Harlan drops by...

His UDF opens another instance of excel, but retrieves that value from a

still
closed workbook.

(Yeah, I got corrected.)

Tom Ogilvy wrote:

I guess I should add that Harlan Grove also has a method that opens

another
verion of Excel, opens the file and extracts the information, but that
really isn't working on a closed workbook. It is primarily posted as a

UDF
method for functions used in worksheets to replace use of the indirect
worksheet function.

Also, Andy Wiggins has a method using sql.request that is supposed to

work
and if the data is in a table, it can be accessed using ADO or perhaps

the
older DAO.

I believe Frank can post a reference to previous posts on those topics.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Essentially Vlookup or any other worksheet function used in VBA or

used in
VBA with Evaluate will not work with a closed workbook such as you

show.
John Walkenbach does document one method that works which uses
ExecuteExcel4Macro, however, this is very slow. It is often

easier/faster
to write you formula in a cell, collect the result, clear the cell.

http://j-walk.com/ss/excel/tips/tip82.htm
A VBA Function to Get a Value From a Closed File

--
Regards,
Tom Ogilvy


"Jill" wrote in message
...
Hi Frank
Tried your suggestion this returns a 'type mismatch' error
any other suggestions.
thanks Jill
-----Original Message-----
Hi
try:
Ix = application.evaluate("=VLookup(c21, 'C:\Documents and
Settings\Jill\My
Documents\[EmailNames.xls]sheet1'!a1:b20, 2, 0)")

--
Regards
Frank Kabel
Frankfurt, Germany

"Jill" schrieb im
Newsbeitrag
...
Anyone know why the following code returns 'sub or
function not defined' and highlights Vlookup, am I
missing
a reference?
Thanks for any help.

Dim Ix As String
Ix = VLookup(c21, "C:\Documents and Settings\Jill\My
Documents\[EmailNames.xls]sheet1!a1:b20", 2, False)
MsgBox Ix
End Sub

.




--

Dave Peterson



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default error message in Vlookup

I have been able to correct the problem by placing the
reference table on the sheet that calls the macro (an open
table) the procedure now works perfectly.
Many thanks to all who have contributed
Jill
-----Original Message-----
[...]
Also, Andy Wiggins has a method using sql.request that

is supposed to
work
and if the data is in a table, it can be accessed using

ADO or
perhaps the
older DAO.

I believe Frank can post a reference to previous posts

on those
topics.

here we go:
http://tinyurl.com/2c62u

Frank

.

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
Vlookup Error Message - Excel 2003 Kim Excel Discussion (Misc queries) 9 August 24th 09 05:50 PM
error message during vlookup Deb Pingel Excel Discussion (Misc queries) 2 August 17th 06 03:39 PM
VLOOKUP error message Janeen Excel Discussion (Misc queries) 7 December 27th 05 08:55 PM
VLookup in VBA giving error message ayl322 Excel Discussion (Misc queries) 3 July 27th 05 06:06 PM
VLookup error message while accessing range in closed workbook. Peter McNaughton Excel Programming 1 September 10th 03 06:11 AM


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