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