|
-
Mar 29th, 2004, 10:22 AM
#1
Thread Starter
New Member
Combo Box Problem
I must be missing something completely obvious, but I am using the 'additem' function and when i click on the drop down icon on my combobox - nothing appears.
I've checked all the properties but still nothing.
Please help!
-
Mar 30th, 2004, 02:07 AM
#2
Addicted Member
If you cannot solve this I suggest you copy/paste the code you are using. This code adds open workbook names to a combobox.
'------------------------------------------------
Sub ReSetBookCombo()
FindForm.BookCombo.Clear
For Each wb In Workbooks
FindForm.BookCombo.AddItem (wb.Name)
Next
'FindForm.BookCombo.ListIndex = 0
End Sub
'---------------------------------------------------------
Regards
BrianB
-------------------------------
-
Mar 30th, 2004, 02:26 AM
#3
Thread Starter
New Member
Thanks Brian,
Under the workbook 'Open' event, I have entered the following code:
Private Sub Workbook_Open()
cmbPeriod.AddItem = "P1"
End Sub
However, when the workbook opens there is nothing in the comboBox, and I don't know why.
Many thanks.
-
Mar 30th, 2004, 04:38 AM
#4
Addicted Member
Aha. Looks like the CB is in a worksheet. I had assumed from your question that it was in a form. You are using the wrong method.
'------------------------------------------
If you used the Forms toolbar
right click the cb to get a menu.
Format Control
Control
In Input Range type A1 (or whatever). If you want more items make a bigger range eg. A1:A10
'--------------------------------------------------
If you used the Controls toolbar (not recommended for numerous controls because there are bugs)
Get the Controls toolbar
Click on Design Mode Button
Click on Properties button
ListFillRange ... type A1
'-------------------------------------------------
You code should be something like :-
Code:
Private Sub Workbook_Open()
Worksheets("Sheet1").Range("A1").Value= "P1"
End Sub
Regards
BrianB
-------------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|