+ Reply to Thread
Results 1 to 24 of 24

application vlookup error runtime error 1004, unable to get the vlookup property of the.."

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    application vlookup error runtime error 1004, unable to get the vlookup property of the.."

    here is the function that is crashing with an error

    Please Login or Register  to view this content.
    so i have a sheet "sheet2" that has a range "hashchar" on it (I1:J62). why is my vlookup failing?

    i have also attached the workbook in case that is needed to debug code.
    Attached Files Attached Files
    Last edited by dmcgov; 12-04-2018 at 07:47 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    Your VBA project is password protected.
    If posting code please use code tags, see here.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    You password does not work, why password protect a sample workbook?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    It's a named range, not a VBA variable, and it's not sorted so you need to use:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,529

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    If "hashchar" is a named range, I believe you would use
    range("hashchar")
    For example

    Please Login or Register  to view this content.

  6. #6
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    sorry norie, i forgot to un protect the project, the password is "password".

    let me know if that doesn't work.

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so i changed the code to match what you guys have written and still getting an error on the vlookup line. see entire code below:

    Please Login or Register  to view this content.
    so the error message is still run time error 1004, unable to get the vlookup property of the worksheetfunction class

    thoughts?

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    That does not match what either of us wrote. Check the last argument to Vlookup.

  9. #9
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    thanks rorya, i got that fixed, apprecitate you letting me know.

    so here is the updated code, still getting run time error 1004 - unable to get the vlookup property of the worksheetfunction class.

    what am i doing wrong?

    Please Login or Register  to view this content.

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    That means that whatever you are looking up does not appear in the first column of the lookup range.

  11. #11
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    ok so after some thought, i realized that my hash sub is correctly making the hashchar but it bails when the char1 is zero "0". see code below, and i will upload the workbook to see if that helps in debugging my issues.


    Please Login or Register  to view this content.
    so it bails when hash_char is 0 (probably any number), i tried to use CStr to convert it to a string but it doesn't work. here is the file:
    Attached Files Attached Files

  12. #12
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    Declare char1 as a Variant, not String, then use:

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so rorya, when i declare char1 as a variant (and not a string), then the macro fails and doesn't display anything.

    if i leave it to string, then the output works as expected till it hits "0", then it bails and the output stops and doesn't display the correct letter/number.

    so i set up a page "sheet2" under Hash Formula and i get the correct letters until it hits zero "0" and then it stops from there. i tried any number from 1 to 9 and it works. it only stops when char1 is a zero "0"

    what am i doing wrong?

  14. #14
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so last thing. on my sheet2, i have the hashname split up into different cells that contain one letter/number. i was able to write a formula (ifna) to add the correct letter, so it works on that sheet. the question is how to make my formula work in the module.

    EDIT: i am almost there. the following code works, except it is printing a blank line after substituting I for 0. how can i fix this?

    Please Login or Register  to view this content.

  15. #15
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so after some thought, i can tell that something isn't quite right.

    in sheet2, i have a formula in M2 that is: =LEFT($O$2,1) where O2 is a string of numbers and letters
    in cell N2, i have the following formula: =VLOOKUP(M2,G:I,3,FALSE) where G:I contains the table of letters that i am substituting.

    so anything in column M is just one character (from O2) and everything in column N should be one character as well.

    so if M2 is letter, then N2 shows the appropriate hashvalue. but if M2 is a number (even though it tests as a string), then i get an #NA in column N. im sure that this is why my sub hash is not printing the appropriate values.

    can someone just tell me why this is happening?

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    Are you sure you have things the right way round?

    The column to look for the lookup value in is the leftmost column in the lookup range.

  17. #17
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so as with all things excel, there are ways around issues and so i just rewrote my code to not be a MID string and just parsed out the letters in a range. so i got this working and it seems to be fine.

  18. #18
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so i have a question about how to find a row number within a range

    the range is on sheet "hdn_Codes" and is found in A1:A4

    i have looked at match and find and i can't get them working for some reason. here is the code below, just a few lines.

    Please Login or Register  to view this content.

  19. #19
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    Please Login or Register  to view this content.
    should work. It actually returns the position in the range, but since your range starts in row 1, that will be the row number too.

  20. #20
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    so i tried what you said and i get an error message:

    run time error 1004, unable to get the match property of the worksheetfunction class.

    how can i fix this.

  21. #21
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    That simply means the value isn't in that range.

  22. #22
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    let me upload it. i know that the city is found in A1:A4 of the hdn_Codes sheet.
    Attached Files Attached Files

  23. #23
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    to display the hdn_Codes sheet, goto Mainsheet, select Unhide Cities by password, type in "master" and when the password textbox opens up, type in "Password". that will unhide that sheet.

    please let me know what you find.

  24. #24
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,145

    Re: application vlookup error runtime error 1004, unable to get the vlookup property of th

    Bangalore is in A5.

+ 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. Runtime Error 1004 : Unable to get the Match Property
    By agengler11 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2018, 11:59 AM
  2. [SOLVED] run-time error '1004' unable to get the vlookup property of the worksheetfunction class
    By Sintek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-23-2016, 02:26 PM
  3. runtime error 1004 unable to get match property
    By AAvcal71 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2014, 03:10 PM
  4. error 1004 unable to get the vlookup property of the worksheet function class
    By steve99g in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-20-2013, 04:35 PM
  5. 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
  6. Run time error 1004 unable to get the vlookup property of the worksheet function class
    By surajitbose in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2012, 06:12 PM
  7. Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction c
    By BlondOIverBlue in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2010, 12:37 AM

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