+ Reply to Thread
Results 1 to 5 of 5

vba: VLookUp Function in one userform

Hybrid View

  1. #1
    Registered User
    Join Date
    06-12-2014
    Location
    Makati Philippines
    MS-Off Ver
    MS OFFICE 2010
    Posts
    58

    vba: VLookUp Function in one userform

    Hi All,

    Please see attached file for my sample workbook.
    What i would want to happen is that i want to be able to use Vlook up by using the Value of the Textbox1 in the Info form and place the vlookup result in the fnameresult box.
    Data are in Nickname sheet A:B


    Greatful for immediate assistance.

    test template.xlsm
    Last edited by saikong051; 08-27-2014 at 02:24 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: vba: VLookUp Function in one userform

    Hi, saikong051,

    maybe try
    Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
      Dim var As Variant
      On Error Resume Next
      var = WorksheetFunction.VLookup(CStr(TextBox1.Value), Sheets("Nickname").Range("A:B"), 2, 0)
      On Error GoTo 0
      If IsEmpty(var) Then
        fnameresult.Value = ""
      Else
        fnameresult.Value = var
      End If
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-12-2014
    Location
    Makati Philippines
    MS-Off Ver
    MS OFFICE 2010
    Posts
    58

    Re: vba: VLookUp Function in one userform

    Hi HaHoBe,

    Should i place it in the Info FORM?

    i tried it but showing blank result.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: vba: VLookUp Function in one userform

    Hi, saikong051,

    did you adapt the name to meet your needs? Yes, code goes behind the UF Info. And you would need to leave the textbox in order to get the code going.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    06-12-2014
    Location
    Makati Philippines
    MS-Off Ver
    MS OFFICE 2010
    Posts
    58

    Re: vba: VLookUp Function in one userform

    Its working now. thank you so much HaHoBe.

    +Rep added.

+ 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. Can't use If function with Vlookup in userform
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-09-2013, 06:01 PM
  2. Vlookup and Match function [vba--userform]
    By feixiiin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2013, 10:35 PM
  3. Userform Search Function Autofilter Results and Repopulate Userform
    By cindy71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2012, 03:46 PM
  4. [SOLVED] Userform Find (VLOOKUP) function search string problem
    By TalResha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2011, 04:14 AM
  5. Replies: 1
    Last Post: 12-02-2005, 09:35 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