+ Reply to Thread
Results 1 to 13 of 13

“Unable to get the VLookup property of the WorksheetFunction Class” error

  1. #1
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    “Unable to get the VLookup property of the WorksheetFunction Class” error

    Hi all, I am trying to set the values in column B in my Workbook "Copy of Dash Board Shell" (shown in the image below) equal to the value derived from my HLOOKUP function from my data workbook shown as second image below
    Copy of Dash Board Shell
    Capture.PNG

    Data File
    capture 1.PNG

    so esentially the code will find a match in the data file and copy its MIS number and paste it in the desired location on the Dash Board file, heres my code, I keep getting an error because I dont know the syntax, can someone help?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Maybe:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    You don't need to select or activate ranges or sheets in your code, the only purpose those functions serve is to make your code slower.
    Personally I would use Range.Find over calling Vlookup, something like.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    I get another syntax error with that.... Capture.PNG

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Quote Originally Posted by lougs7 View Post
    I get another syntax error with that.... Attachment 423943
    If you feel the need to post images please do not use .PNG format, they are not visible to most users.

    edit:- I was able to view the image by opening the attachment, you got an error because you didn't copy xladept's code correctly.

    Delete "Range(" from the start of the erroneous line then it should compile, though no guarantee it will execute without error.
    Last edited by jason.b75; 10-09-2015 at 04:55 PM.

  6. #6
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Quote Originally Posted by jason.b75 View Post
    You don't need to select or activate ranges or sheets in your code, the only purpose those functions serve is to make your code slower.
    Personally I would use Range.Find over calling Vlookup, something like.

    Please Login or Register  to view this content.


    Hey Jason, Im open to anything if you think find is better I may just use that.

    I got an error though, it says "Application-defined or Object-defined error" when I run the code

    Attachment 423947

    Do you know how to get around this?

  7. #7
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    sorry wont post .PNG anymore. What file format is best?

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Jpeg is probably the safest if you do need to post an image.

    I have edited my previous post to show why you had the error with xladept's suggestion.

    Which line was the error caused by in my code? It was a quick untested hash so it could have a couple of typos in it.

  9. #9
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Quote Originally Posted by jason.b75 View Post
    Jpeg is probably the safest if you do need to post an image.

    I have edited my previous post to show why you had the error with xladept's suggestion.

    Which line was the error caused by in my code? It was a quick untested hash so it could have a couple of typos in it.

    Jason thank you so much, this worked. I know this could be asking for a lot out of you, but say for example the field for MIS number is blank, the code will give an error which is normal. How do you add an error handler within the loop that if the value is "" it keeps going to the next entry. I am going to try your Find code now and get back to you. Thanks again you saved me!

  10. #10
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Quote Originally Posted by jason.b75 View Post
    Jpeg is probably the safest if you do need to post an image.

    I have edited my previous post to show why you had the error with xladept's suggestion.

    Which line was the error caused by in my code? It was a quick untested hash so it could have a couple of typos in it.

    I get an error with the line
    "For Each c In .Range("A3", .Cells(Rows.Count, "A").End(xlUp).Row)"

    maybe is because 'c 'wasn't set equal to something yet in the code, we declared it as a range but never set the range equal to something? Thats my guess. I didnt touch your code all is the same from above

  11. #11
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Hopefully xladept can answer that one, error handling is one of my reasons for using Find instead of Vlookup.

    Using Find, this part traps any potential errors
    Please Login or Register  to view this content.
    Basically no match returns an empty variable (rFound Is Nothing) so we can tell the code what to do if the match is nothing or if it is something, there is no error involved here.
    With Vlookup, no match automatically returns an error, so you have to trap in, either with more worksheet functions, or with vba On Error, both of which can get pretty messy.

  12. #12
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Quote Originally Posted by lougs7 View Post
    I get an error with the line
    "For Each c In .Range("A3", .Cells(Rows.Count, "A").End(xlUp).Row)"

    maybe is because 'c 'wasn't set equal to something yet in the code, we declared it as a range but never set the range equal to something? Thats my guess. I didnt touch your code all is the same from above
    Typo number 1 That line should be

    Please Login or Register  to view this content.
    c refers to each cell in the range, it doesn't need to be set, just available for the code to use.

  13. #13
    Forum Contributor
    Join Date
    09-23-2015
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    187

    Re: “Unable to get the VLookup property of the WorksheetFunction Class” error

    Jason it works! Thank you kindly, you sir are awesome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Unable to get the Vlookup Property of the WorkSheetFunction Class
    By jayeshsondhi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-22-2015, 03:57 AM
  2. Run - time error '1004': Unable to get the Sum property of WorksheetFunction class
    By dylanrose in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 10:25 AM
  3. [SOLVED] Unable to Get the Vlookup property of the WorksheetFunction class
    By DrowingInVBA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2013, 02:02 PM
  4. Run-time Error 1004: Unable to get the VLookup property of the WorksheetFunction class
    By sridhar_neel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2012, 04:21 AM
  5. Unable to get the VLookup property of the WorksheetFunction class
    By JesseBurton in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 12-09-2009, 10:29 AM
  6. Replies: 2
    Last Post: 12-13-2007, 09:59 AM
  7. Unable to get the Vlookup property of the WorksheetFunction class
    By DoctorG in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2006, 02:55 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1