ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setup ComboBox when open workbook (https://www.excelbanter.com/excel-programming/382290-setup-combobox-when-open-workbook.html)

Sören_Marodören

Setup ComboBox when open workbook
 
Hi,

I want to fill a ComboBox with items when I open the Workbook.
But I don't want to take the items from cells in the worksheet.
So I tried these lines:

Private Sub Workbook_Open()
ComboBox1.List = Array("First", "Second", "Third", "Forth")
End Sub

But this does not work.
What is missing.

Thanks in advance,
/Sören


Mike

Setup ComboBox when open workbook
 
It probably doesn't know where the combo box is

Private Sub Workbook_Open()
Worksheets("Sheet1").ComboBox1.List = Array("Item1", "Item2", "Item3")
End Sub

"Sören_Marodören" wrote:

Hi,

I want to fill a ComboBox with items when I open the Workbook.
But I don't want to take the items from cells in the worksheet.
So I tried these lines:

Private Sub Workbook_Open()
ComboBox1.List = Array("First", "Second", "Third", "Forth")
End Sub

But this does not work.
What is missing.

Thanks in advance,
/Sören


RichardSchollar

Setup ComboBox when open workbook
 
Hi Soren

If your combobox is located on sheet1 say, then try prefixing the
combobox statement with the location ie:

Private Sub Workbook_Open()
Sheets("Sheet1").ComboBox1.List = Array("First", "Second",
"Third", "Forth")
End Sub

Hope this helps!

Richard


On 31 Jan, 08:53, Sören_Marodören
wrote:
Hi,

I want to fill a ComboBox with items when I open the Workbook.
But I don't want to take the items from cells in the worksheet.
So I tried these lines:

Private Sub Workbook_Open()
ComboBox1.List = Array("First", "Second", "Third", "Forth")
End Sub

But this does not work.
What is missing.

Thanks in advance,
/Sören





All times are GMT +1. The time now is 11:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com