+ Reply to Thread
Results 1 to 6 of 6

Vlookup code not working in this instance only

  1. #1
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Vlookup code not working in this instance only

    Hi all,

    Can anyone explain to me why this first code works

    Private Sub Username_AfterUpdate()
    Me.pwdcheck1.Visible = True
    Me.pwdcheck1 = Application.WorksheetFunction.VLookup(Me.Username, Sheet2.Range("G:H"), 2, False)
    Me.pwdcheck1.Visible = False
    End Sub

    and why this second code doesn't?

    Private Sub CboPatient_AfterUpdate()
    Me.AUID = Me.CboPatient
    Me.AUID.SetFocus
    Me.Surname = Application.WorksheetFunction.VLookup(Me.AUID, Sheets("Registrations").Range("B:D"), 3, False)
    <Error Code breaks here>
    Me.Firstname = Application.WorksheetFunction.VLookup(Me.AUID, Sheet3.Range("B:E"), 4, False)
    End Sub

    I tried a combination of codes, as can be seen on the Me.Firstname line, but when applied on the Me.Surname line it stops at the same place as the current code in the second example above
    I keep getting Error 1004 'unable to get the VLookup property of the WorksheetFunction class"

    Each code is on a different userform, the first userform is FrmPassword, and the second is FrmCNClients


    thanks in anticipation!
    Pete
    Pete
    Struggling Solutions Architect

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,936

    Re: Vlookup code not working in this instance only

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: Vlookup code not working in this instance only

    Reply retracted until request from moderator have been satisfied.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Vlookup code not working in this instance only

    withdrawn by Hum
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Vlookup code not working in this instance only

    Hi all,

    Can anyone explain to me why this first code works

    Please Login or Register  to view this content.
    and why this second code doesn't?

    Please Login or Register  to view this content.
    I tried a combination of codes, as can be seen on the Me.Firstname line, but when applied on the Me.Surname line it stops at the same place as the current code in the second example above
    I keep getting Error 1004 'unable to get the VLookup property of the WorksheetFunction class"

    Each code is on a different userform, the first userform is FrmPassword, and the second is FrmCNClients


    thanks in anticipation!
    Pete

  6. #6
    Forum Contributor
    Join Date
    06-23-2014
    Location
    Dubbo, Australia
    MS-Off Ver
    EXCEL 2019
    Posts
    180

    Re: Vlookup code not working in this instance only

    solved, I worked it out

+ 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. Counting instance in a column, COUNTIF not working for it
    By Alexm963 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-24-2014, 10:13 PM
  2. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  3. Replies: 1
    Last Post: 10-04-2013, 05:54 PM
  4. VLOOKUP - Last Instance
    By jndickin in forum Excel General
    Replies: 4
    Last Post: 08-11-2009, 03:39 PM
  5. VLOOKUP more than one instance
    By starbwoy in forum Excel General
    Replies: 4
    Last Post: 03-28-2008, 10:50 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