Forum Home
Press F1
 
Thread ID: 15903 2002-02-20 10:58:00 Combobox in Excel Guest (0) Press F1
Post ID Timestamp Content User
36429 2002-02-20 10:58:00 Hello!

I am trying to make a macro in Excel where I want to initialize a combobox in Sheet1 with text-entries in Column A of Sheet2.

For example

If I have 'Cat' in A1, 'Dog' in A2 in Sheet2, when the file is opened, the combobox in Sheet1 should contain the values 'Dog' and 'Cat'.

I have tried using a number of ways, but to no avail. Could somebody help me plz?
Guest (0)
36430 2002-02-20 20:03:00 Not sure if I completely understand, but I will give this a try.

Just appending the text of one cell to another use:

=A1&Sheet2!A2

If you want to add a space between words, use:

=A1&' '&Sheet2!A2

The & concatenates strings, the + is for addition.

Is this what you were after?

robo.
Guest (0)
36431 2002-02-20 23:38:00 The associated .ListIndex property of the ComboBox list uses the relative number position of each item to relate to its position in the list in the worksheet.
As a result, you would not be able to intersperse two different lists in the same Combobox as the position in that list would not relate to a meaningful position in either one of the two worksheet lists.

Would a Combobox for each list provide a solution?
Guest (0)
36432 2002-02-21 01:35:00 How about a list in which the appropriate values are grabbed from the separate sheets, and then let the combo-box point to this list which could be hidden if desired.

G P
Guest (0)
36433 2002-02-21 09:28:00 Hi, Thanks for your rapid response and I apologize for the obscurity in my explanation of the problem.

1) There will only be one list (of the subjects that I am currently taking in uni).

2) I do not wish to modify the VB code in the macro every time I add a new subject to the list. Therefore, I would want to place all the data items (the subjects) in column A of the 2nd Worksheet in the Workbook. When the Workbook file is opened, it reads the data in column A of the 2nd Worksheet, and fill the Combobox (which is in the 1st Worksheet named 'Timetable') with the data.

Whenever I want to add another subject, I simply append it to the last used row in Column A of the 2nd Worksheet.

I hope this is a clearer version of the problem.

Thanks for taking time reading this :). I really would like to know how.

==James==
Guest (0)
1