简体   繁体   中英

VBA Userform Combobox - Help required

Good morning,

I am trying to populate a combobox with selective data, but cannot get my head around what i need to do. I have some experience with SQL and can use a sql query to replicate what I need, but in Excel VBA I am struggling. It is probably quite simple, but I am having a senior moment I think!!

I have a table with two Columns

Column one (C1) holds unique serial numbers, whereas column 2 (C2) holds equipment type

In sql the query would be "SELECT C1 From Table WHERE C2 = $string" where $string would be the Value of selected equipment type. This would then populate the dropdown using a foreach instruction

The table shows

Table example

In the example, how would I show just the serial numbers relating to the selected equipment type

Any advice would be much appreciated

I have created a range called 'oNumbers' on a separate sheet which contains all the serial numbers, and have a cell which contains the equipment type code, but other than that I cannot fathom out what I need to do

Google can help you on all kinds of VBA questions with examples - like https://analysistabs.com/vba-code/excel-userform/combobox/

This is not a chat forum;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM