+ Reply to Thread
Results 1 to 5 of 5

Userform dependant combox to return adjacent record values in several columns

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    2

    Userform dependant combox to return adjacent record values in several columns

    Thread Title: Userform dependant combox to return adjacent record values in several columns

    I have a dynamic vegetation database, currently with 3,500 records. I have designed a userform to select records from this database and send to a list called Plants of Interest. The database has 6 columns: Area (there are only 4 areas), Species, Family, Common Name, Grid location and Comments. On the userform I have set up 2 dependent comboboxes: CboArea, which uses a named range of unique area values called "AreaList", which is o a different worksheet to the database. The other combobox is called CboSpecies and uses a named range in the database called "AreaSpecies", and operates so that when a particular area in CboArea is selected, CboSpecies is populated only with species in that area. This all works OK. The userform also has 4 textboxes for Family, Common Name, Grid location and Comments. I want these textboxesto be popuated with the corresponding values in adjacent columns of the same row (ie the same record). So, once the desired area and species are selected using the comboboxes, the 4 textboxes should be bound to the Area and species selected (which is unique).

    My problem is: I can't get the textboxes to populated with the correct coresponding values. It works properly for the first area and species combination, however if the second, third or fourth area are selected, the 4 textboxes still have values correspondng to the first area.

    I have attached the excel file which includes the VBS code for what I have done so far. The Plans of Interest sheet has some examples of exported records from the database to illustrate the problem.

    I am fairly new to VBS coding, so any help will be gratefully received!

    The code in the Userform is as follows:

    Option Explicit
    Option Base 1
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by chuxtable; 05-18-2012 at 04:09 AM. Reason: Inconcise thread title

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Charles Huxtable

    Hi Charles, welcome to the forum.

    Please take a moment to read the forum rules (link in my signature below) and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    Thank you.

  3. #3
    Registered User
    Join Date
    05-16-2012
    Location
    Newcastle
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Charles Huxtable

    Paul, I have amended my thread - have changed the title and added code. Hopefully this is better now and can go ahead. Many thanks, Charles

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Charles Huxtable

    Charles,

    To change a Title on your post, click EDIT then Go Advanced and change your title in the Title box, if 2 days have passed ask a moderator to do it for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Charles Huxtable

    Paul, deleting my post seems unjust - I was composing it before you intervened and so didn't see it. Seems dumb to nuke an answer whatever the guy has done.

+ 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