PC Review


Reply
Thread Tools Rate Thread

Cant find VLookup property

 
 
Merlynsdad
Guest
Posts: n/a
 
      2nd Nov 2009
I have a line of code that has been working for weeks in a macro and is as
follows:

strSeid =
Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
Worksheets("Lists").Range("B2:E250"), 2, False)

All of a sudden this morning when the code gets to it I'm getting an error
"Unable to get the Vlookup property of the Worksheet function class." I have
no idea what's going on. Nothing has changed in this workbook. The ranges are
valid, the variable is Dim'd, the value exists in the Lists range.

Any help will be greatly appreciated!
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Nov 2009
The lookup value is missing...Modify your code to handle that

Dim strSeid As Variant
strSeid = Application.VLookup(Worksheets("Temp").Range("$B$31"), _
Worksheets("Lists").Range("B2:E250"), 2, False)
If IsError(strSeid) Then
MsgBox "Cannot find"
Else
MsgBox strSeid
End If

If this post helps click Yes
---------------
Jacob Skaria


"Merlynsdad" wrote:

> I have a line of code that has been working for weeks in a macro and is as
> follows:
>
> strSeid =
> Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
> Worksheets("Lists").Range("B2:E250"), 2, False)
>
> All of a sudden this morning when the code gets to it I'm getting an error
> "Unable to get the Vlookup property of the Worksheet function class." I have
> no idea what's going on. Nothing has changed in this workbook. The ranges are
> valid, the variable is Dim'd, the value exists in the Lists range.
>
> Any help will be greatly appreciated!

 
Reply With Quote
 
Merlynsdad
Guest
Posts: n/a
 
      2nd Nov 2009
You're correct; there was a problem with the match. I put your code in, but
if there is no match it goes directly to the error handler for the module and
never gets to the If IsError line. If I put an "OnError Resume Next" in
before the vlookup line, how do I get rid of it after that line so the module
error handler still works?

"Jacob Skaria" wrote:

> The lookup value is missing...Modify your code to handle that
>
> Dim strSeid As Variant
> strSeid = Application.VLookup(Worksheets("Temp").Range("$B$31"), _
> Worksheets("Lists").Range("B2:E250"), 2, False)
> If IsError(strSeid) Then
> MsgBox "Cannot find"
> Else
> MsgBox strSeid
> End If
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Merlynsdad" wrote:
>
> > I have a line of code that has been working for weeks in a macro and is as
> > follows:
> >
> > strSeid =
> > Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
> > Worksheets("Lists").Range("B2:E250"), 2, False)
> >
> > All of a sudden this morning when the code gets to it I'm getting an error
> > "Unable to get the Vlookup property of the Worksheet function class." I have
> > no idea what's going on. Nothing has changed in this workbook. The ranges are
> > valid, the variable is Dim'd, the value exists in the Lists range.
> >
> > Any help will be greatly appreciated!

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      2nd Nov 2009
Please note that the variable is declared as variant

Dim strSeid As Variant


If this post helps click Yes
---------------
Jacob Skaria


"Merlynsdad" wrote:

> You're correct; there was a problem with the match. I put your code in, but
> if there is no match it goes directly to the error handler for the module and
> never gets to the If IsError line. If I put an "OnError Resume Next" in
> before the vlookup line, how do I get rid of it after that line so the module
> error handler still works?
>
> "Jacob Skaria" wrote:
>
> > The lookup value is missing...Modify your code to handle that
> >
> > Dim strSeid As Variant
> > strSeid = Application.VLookup(Worksheets("Temp").Range("$B$31"), _
> > Worksheets("Lists").Range("B2:E250"), 2, False)
> > If IsError(strSeid) Then
> > MsgBox "Cannot find"
> > Else
> > MsgBox strSeid
> > End If
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Merlynsdad" wrote:
> >
> > > I have a line of code that has been working for weeks in a macro and is as
> > > follows:
> > >
> > > strSeid =
> > > Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
> > > Worksheets("Lists").Range("B2:E250"), 2, False)
> > >
> > > All of a sudden this morning when the code gets to it I'm getting an error
> > > "Unable to get the Vlookup property of the Worksheet function class." I have
> > > no idea what's going on. Nothing has changed in this workbook. The ranges are
> > > valid, the variable is Dim'd, the value exists in the Lists range.
> > >
> > > Any help will be greatly appreciated!

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      2nd Nov 2009
And Jacob didn't use application.worksheetfunction.vlookup().

He use application.vlookup().

That syntax doesn't cause a runtime error if there is no match
(application.worksheetfunction.vlookup() will cause a runtime error if there is
no match).

Merlynsdad wrote:
>
> You're correct; there was a problem with the match. I put your code in, but
> if there is no match it goes directly to the error handler for the module and
> never gets to the If IsError line. If I put an "OnError Resume Next" in
> before the vlookup line, how do I get rid of it after that line so the module
> error handler still works?
>
> "Jacob Skaria" wrote:
>
> > The lookup value is missing...Modify your code to handle that
> >
> > Dim strSeid As Variant
> > strSeid = Application.VLookup(Worksheets("Temp").Range("$B$31"), _
> > Worksheets("Lists").Range("B2:E250"), 2, False)
> > If IsError(strSeid) Then
> > MsgBox "Cannot find"
> > Else
> > MsgBox strSeid
> > End If
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Merlynsdad" wrote:
> >
> > > I have a line of code that has been working for weeks in a macro and is as
> > > follows:
> > >
> > > strSeid =
> > > Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
> > > Worksheets("Lists").Range("B2:E250"), 2, False)
> > >
> > > All of a sudden this morning when the code gets to it I'm getting an error
> > > "Unable to get the Vlookup property of the Worksheet function class." I have
> > > no idea what's going on. Nothing has changed in this workbook. The ranges are
> > > valid, the variable is Dim'd, the value exists in the Lists range.
> > >
> > > Any help will be greatly appreciated!


--

Dave Peterson
 
Reply With Quote
 
Charlie
Guest
Posts: n/a
 
      2nd Nov 2009
On Error GoTo 0

....will turn off the On Error Resume Next (Note that's a zero not letter "o")

"Merlynsdad" wrote:

> You're correct; there was a problem with the match. I put your code in, but
> if there is no match it goes directly to the error handler for the module and
> never gets to the If IsError line. If I put an "OnError Resume Next" in
> before the vlookup line, how do I get rid of it after that line so the module
> error handler still works?
>
> "Jacob Skaria" wrote:
>
> > The lookup value is missing...Modify your code to handle that
> >
> > Dim strSeid As Variant
> > strSeid = Application.VLookup(Worksheets("Temp").Range("$B$31"), _
> > Worksheets("Lists").Range("B2:E250"), 2, False)
> > If IsError(strSeid) Then
> > MsgBox "Cannot find"
> > Else
> > MsgBox strSeid
> > End If
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Merlynsdad" wrote:
> >
> > > I have a line of code that has been working for weeks in a macro and is as
> > > follows:
> > >
> > > strSeid =
> > > Application.WorksheetFunction.VLookup(Worksheets("Temp").Range("$B$31"),
> > > Worksheets("Lists").Range("B2:E250"), 2, False)
> > >
> > > All of a sudden this morning when the code gets to it I'm getting an error
> > > "Unable to get the Vlookup property of the Worksheet function class." I have
> > > no idea what's going on. Nothing has changed in this workbook. The ranges are
> > > valid, the variable is Dim'd, the value exists in the Lists range.
> > >
> > > Any help will be greatly appreciated!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not find a property named '... ' on the type specified by the DataObjectTypeName property in ObjectDataSource '...' Anabela Silva Microsoft ADO .NET 3 7th Feb 2010 01:09 PM
Vlookup problem - unable to get the vlookup property Fred Microsoft Excel Programming 2 22nd Aug 2008 05:23 PM
Vlookup property missing Jennifer Microsoft Excel Programming 3 30th Nov 2007 12:54 PM
Could not find a property named '... ' on the type specified by the DataObjectTypeName property in ObjectDataSource '...' Anabela Silva Microsoft ASP .NET 0 1st Nov 2006 07:08 PM
Unable to get VLOOKUP property cici Microsoft Excel Programming 1 10th Feb 2004 11:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:51 PM.