+ Reply to Thread
Results 1 to 4 of 4

Thread: VLOOKUP in userform

  1. #1
    Registered User
    Join Date
    06-01-2004
    Posts
    11

    Unhappy VLOOKUP in userform

    Hi, I have a last small problem. I tried everything, but I can't nail it.

    I have a closed external file. In this file I have two columns A and B. A contains names and B personal messages.

    In the "internal" Excel 2003 file I have a multipage userform. On the second page I have a textbox that has to show the personal message on the basis of the name entered in the first page (textbox "Naam"). How do I do that? I think it's handy to put the code in the button on page 1 that navigates to page 2.

    Dim ExtBk As Workbook
    Dim ExtFile As String
    
    ExtFile = "K:\Boodschap.xls"
    Set ExtBk = Workbooks(Dir(ExtFile))
    
    Message.Value = Application.VLookup(Naam.Value, ExtBk.Sheets("sheet1").Range("A1:B20"), 2, 0)

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: VLOOKUP in userform

    Why do you need VBA, VLOOKUP works across workbooks
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  3. #3
    Registered User
    Join Date
    06-01-2004
    Posts
    11

    Re: VLOOKUP in userform

    I need VBA because I use a userform. This is managed by VBA.

  4. #4
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: VLOOKUP in userform

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.

    Doing this will ensure you get the result you need!
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0