misiek294 wrote: ... value2 = Array ("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K" , "L", "M", "N") '14 entries
Do you have to enter these values manually?
I have them in the database of over 30 - numbers and names ...
It was supposed to be just an example

... sure you don't need ...
To review changes in "
ini ","
dopisz_do_bazy " and "
usun_z_bazy "
Przykład o...i_0001.zip Download (20.55 kB)
For many lists to fill, you just need to 'multiply' variables such as'
value2 '', give them proper names and instructions for counting the number of nonblank rows in a given column (less than 1 row per header), calculate the number of entries to insert into the given list and assign them to the property '
.Letter() "given list.
Instructions for counting the number of non-empty cells have different forms depending on the preferences of those using them, for me it is, for example, the sheet function "
COUNT () "or in Polish"
COUNTA () " as:
"
w = Application.CountA (ThisWorkbook.Sheets (settings). Columns (1)) "
in other words, non-empty rows calculated after the column
"A" = Columns (1)
Others prefer to use it for this'
pure vba syntax ' as:
w = ThisWorkbook.Sheets (settings). Cells (Rows.Count, 1). End (xlUp). Row
or
w = ThisWorkbook.Sheets (settings) .Range ("a1"). CurrentRegion.Rows.Count .
where the column number in which non-empty cells are counted is one in "Cells (Rows.Count,
1 ) "and letter"
and "in Address Range (" a1 ").
In option with "
CurrentRegion.Rows "you just have to be careful that the single-column spacing between data for lists is kept, otherwise the command 'will select the column with the most entries for counting'.
And then it's just a loop ...

...

...:
... and assigning the variable to .List () of the given list.
The output value of the completed list, but with an unselected entry on it is:
UserForm1.ComboBox1
.ListIndex = -1 and the following:
is the setting for displaying two columns with data in the drop-down list "
.ColumnCount = 2 ", indicating that the data from the first column are to be rewritten to the spreadsheet"
.TextColumn = 1 "and a"
.ColumnWidths = "100; 50 "is the corresponding width of the column data in the drop-down list.
And here is a small complication - in the case of 'single-column' lists, rewriting data to the worksheet as in the example below:
, while in the case of 'suction' lists, data from multidimensional arrays must already refer to the given entries after indexes, i.e. if we have assigned two data to the variable, e.g. employee's name and his identifier, and this table looks like employee's data (index1, index2), where index1 are subsequent names, and index2 is identifiers and the variable 'increased' as below:
then rewriting to the worksheet looks like this:
If we set a different way of filling the board, then you have to rearrange this and that ...
... and if I twisted and twisted something here, then my colleagues from the forum will certainly improve ... so that they don't "put away from honor and faith" too much ...