+ Reply to Thread
Results 1 to 5 of 5

Use textbox input and VLookup to update another textbox on same userform

  1. #1
    Registered User
    Join Date
    04-20-2011
    Location
    Richland, WA
    MS-Off Ver
    Excel 2003/2007
    Posts
    31

    Use textbox input and VLookup to update another textbox on same userform

    I'm trying to use a textbox entry on a userform to populate another textbox (or label) on the same form based on a Vlookup to a dynamic named range. I've tried doing this a number of times and ways with the Vlookup worksheetfunction and all resulted in a "1004" error. I would like to populate CanType from Can and GrossWt from Truck (named ranges CanInfo and TruckInfo). Overall goal is to drive most of the database values from code and not using lookups in individual cells - file size bloat.

    Need push in right (or at least better) direction.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Use textbox input and VLookup to update another textbox on same userform

    Because Can and Truck are integers on the LookUpLists sheet, you need to convert the values of the textboxes to integers (using CInt).

    Try this:

    Please Login or Register  to view this content.

    Dion

  3. #3
    Registered User
    Join Date
    04-20-2011
    Location
    Richland, WA
    MS-Off Ver
    Excel 2003/2007
    Posts
    31

    Re: Use textbox input and VLookup to update another textbox on same userform

    Works great! Thank you!

    Now I can finish the data entry form and merge it with the larger dataset and other modules. Next pint is on me.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Use textbox input and VLookup to update another textbox on same userform

    I wouldn't use VLOOKUP in this situation, Excel has a VBA method called .Find.

    However, to avoid user error why not use CombBoxes for Can & Truck? This would improve input & make the rest simpler

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    04-20-2011
    Location
    Richland, WA
    MS-Off Ver
    Excel 2003/2007
    Posts
    31

    Re: Use textbox input and VLookup to update another textbox on same userform

    Roy

    Thank you.

    I will give that a try also ... difference between brute force and finesse.

    Bob

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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