Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default call to WorksheetFunction fails in 2003

Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction class"

What gives ?

And yes, I have checked the various security options in the Macro Security Tab.

Any pointer appreciated

--alexT
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default call to WorksheetFunction fails in 2003

Alex

you need something like:

Sub test()
a = "not found"
On Error Resume Next
a = WorksheetFunction.VLookup(Range("A1"), Range("B1:C10"), 2, False)
On Error GoTo 0
MsgBox a
End Sub

The error is not very informative but basically it means that the lookup
value wasn't found in the lookup table.

Regards

Trevor


"Alex T" wrote in message
om...
Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction class"

What gives ?

And yes, I have checked the various security options in the Macro Security

Tab.

Any pointer appreciated

--alexT



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default call to WorksheetFunction fails in 2003

On earlier versions of XL, VLookup did not play well as a member of
the WorksheetFunction collection. This worked though:

a = Application.VLookup(...)

I haven't tried it in XL03, so I don't know if the problem is the
same.

If the error was simply that the lookup value wasn't found, VLookup
would return Error 2042 to a, not give a run-time error.

In article ,
"Trevor Shuttleworth" wrote:

Alex

you need something like:

Sub test()
a = "not found"
On Error Resume Next
a = WorksheetFunction.VLookup(Range("A1"), Range("B1:C10"), 2, False)
On Error GoTo 0
MsgBox a
End Sub

The error is not very informative but basically it means that the lookup
value wasn't found in the lookup table.

Regards

Trevor


"Alex T" wrote in message
om...
Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction class"

What gives ?

And yes, I have checked the various security options in the Macro Security

Tab.

Any pointer appreciated

--alexT



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default call to WorksheetFunction fails in 2003

JE

I don't have Excel 2003 so this is tested in Excel 2000 and, without the 'On
Error Resume Next', I get:

Run-time error '1004':
Unable to get the VLookup property of the WorksheetFunction class

which seems to concur with the OP.

This is with "x" in cell A1 and "a" to "c" in B1 to B3, "d" to "f" in C1 to
C3.

A value of "a" in cell A1 returns a "d" in the MsgBox as expected.

Can you help me to construct an example which will fail with error '2042' ?

Regards

Trevor


"J.E. McGimpsey" wrote in message
...
On earlier versions of XL, VLookup did not play well as a member of
the WorksheetFunction collection. This worked though:

a = Application.VLookup(...)

I haven't tried it in XL03, so I don't know if the problem is the
same.

If the error was simply that the lookup value wasn't found, VLookup
would return Error 2042 to a, not give a run-time error.

In article ,
"Trevor Shuttleworth" wrote:

Alex

you need something like:

Sub test()
a = "not found"
On Error Resume Next
a = WorksheetFunction.VLookup(Range("A1"), Range("B1:C10"), 2, False)
On Error GoTo 0
MsgBox a
End Sub

The error is not very informative but basically it means that the lookup
value wasn't found in the lookup table.

Regards

Trevor


"Alex T" wrote in message
om...
Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction class"

What gives ?

And yes, I have checked the various security options in the Macro

Security
Tab.

Any pointer appreciated

--alexT





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default call to WorksheetFunction fails in 2003

as J.E. said, qualify Vlookup with Application instead of Worksheetfunction.

--
Regards,
Tom Ogilvy

Trevor Shuttleworth wrote in message
...
JE

I don't have Excel 2003 so this is tested in Excel 2000 and, without the

'On
Error Resume Next', I get:

Run-time error '1004':
Unable to get the VLookup property of the WorksheetFunction class

which seems to concur with the OP.

This is with "x" in cell A1 and "a" to "c" in B1 to B3, "d" to "f" in C1

to
C3.

A value of "a" in cell A1 returns a "d" in the MsgBox as expected.

Can you help me to construct an example which will fail with error '2042'

?

Regards

Trevor


"J.E. McGimpsey" wrote in message
...
On earlier versions of XL, VLookup did not play well as a member of
the WorksheetFunction collection. This worked though:

a = Application.VLookup(...)

I haven't tried it in XL03, so I don't know if the problem is the
same.

If the error was simply that the lookup value wasn't found, VLookup
would return Error 2042 to a, not give a run-time error.

In article ,
"Trevor Shuttleworth" wrote:

Alex

you need something like:

Sub test()
a = "not found"
On Error Resume Next
a = WorksheetFunction.VLookup(Range("A1"), Range("B1:C10"), 2, False)
On Error GoTo 0
MsgBox a
End Sub

The error is not very informative but basically it means that the

lookup
value wasn't found in the lookup table.

Regards

Trevor


"Alex T" wrote in message
om...
Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction class"

What gives ?

And yes, I have checked the various security options in the Macro

Security
Tab.

Any pointer appreciated

--alexT








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default call to WorksheetFunction fails in 2003

Ah, reading what I expected to see, not what was written.

Regards

Trevor


"Tom Ogilvy" wrote in message
...
as J.E. said, qualify Vlookup with Application instead of

Worksheetfunction.

--
Regards,
Tom Ogilvy

Trevor Shuttleworth wrote in message
...
JE

I don't have Excel 2003 so this is tested in Excel 2000 and, without the

'On
Error Resume Next', I get:

Run-time error '1004':
Unable to get the VLookup property of the WorksheetFunction class

which seems to concur with the OP.

This is with "x" in cell A1 and "a" to "c" in B1 to B3, "d" to "f" in C1

to
C3.

A value of "a" in cell A1 returns a "d" in the MsgBox as expected.

Can you help me to construct an example which will fail with error

'2042'
?

Regards

Trevor


"J.E. McGimpsey" wrote in message
...
On earlier versions of XL, VLookup did not play well as a member of
the WorksheetFunction collection. This worked though:

a = Application.VLookup(...)

I haven't tried it in XL03, so I don't know if the problem is the
same.

If the error was simply that the lookup value wasn't found, VLookup
would return Error 2042 to a, not give a run-time error.

In article ,
"Trevor Shuttleworth" wrote:

Alex

you need something like:

Sub test()
a = "not found"
On Error Resume Next
a = WorksheetFunction.VLookup(Range("A1"), Range("B1:C10"), 2,

False)
On Error GoTo 0
MsgBox a
End Sub

The error is not very informative but basically it means that the

lookup
value wasn't found in the lookup table.

Regards

Trevor


"Alex T" wrote in message
om...
Folks,

for some reason the following code fails in Excel 2003

Application.WorksheetFunction.VLookup(x, y, z, false)

with error

"Unable to get the Vlookup property of the WorksheetFunction

class"

What gives ?

And yes, I have checked the various security options in the Macro

Security
Tab.

Any pointer appreciated

--alexT








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
Excel fails to update call to user-written function. Jim Luedke New Users to Excel 9 August 28th 09 12:46 AM
Excel 2003 WorksheetFunction Functions run-time error Dave Setting up and Configuration of Excel 2 September 24th 07 04:54 PM
Excel 2003 Fails to open template Geroge Excel Discussion (Misc queries) 2 February 27th 07 09:37 PM
Button fails to call macro when open an Excel via Intranet tigertax Excel Discussion (Misc queries) 1 April 12th 05 10:21 AM
.ONACTION macro call fails Wayne Excel Discussion (Misc queries) 2 March 2nd 05 05:10 PM


All times are GMT +1. The time now is 10:33 AM.

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

About Us

"It's about Microsoft Excel"