Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you default a value in a CombBox?
Is it possible to have a ComboBox with a default value based on say Cell A1
which if there is a name, the name defaults in, otherwise it is blank. All while still having the ability to use the dropdown list in the ComboBox? Thanks for your ideas. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you default a value in a CombBox?
If the value is in the combo list just set the Value property to that cell
value ComboBox1.Value = Range("A1").Value -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "TimN" wrote in message ... Is it possible to have a ComboBox with a default value based on say Cell A1 which if there is a name, the name defaults in, otherwise it is blank. All while still having the ability to use the dropdown list in the ComboBox? Thanks for your ideas. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you default a value in a CombBox?
Bob,
The short answer is Yes, it is in the list, but here is the situation. I have a user form with a ComboBox that contains a list of all employees. The user will select an employee from the list in the comobox and that value goes to cell A1 and other calculations occur. When the user is done, they save the file as the selected employee's name. Later, the user will open that saved file to make additions to it. When the saved file is re-opened the combobox is sitting empty waiting on the user to select the employee. I would like it to default in the employee's name from the saved file since that file will always be dedicated to that employee. However, if the user goes back to the original template (not a saved employee file) the combobox would be empty since there is name to default in, a blank combobox is approrpriate. "Bob Phillips" wrote: If the value is in the combo list just set the Value property to that cell value ComboBox1.Value = Range("A1").Value -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "TimN" wrote in message ... Is it possible to have a ComboBox with a default value based on say Cell A1 which if there is a name, the name defaults in, otherwise it is blank. All while still having the ability to use the dropdown list in the ComboBox? Thanks for your ideas. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can you default a value in a CombBox?
Private Sub Workbook_Open()
With Worksheets(1) If .Range("A1").Value < "" Then .OLEObjects("ComboBox1").Object.Value = .Range("A1").Value End If End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "TimN" wrote in message ... Bob, The short answer is Yes, it is in the list, but here is the situation. I have a user form with a ComboBox that contains a list of all employees. The user will select an employee from the list in the comobox and that value goes to cell A1 and other calculations occur. When the user is done, they save the file as the selected employee's name. Later, the user will open that saved file to make additions to it. When the saved file is re-opened the combobox is sitting empty waiting on the user to select the employee. I would like it to default in the employee's name from the saved file since that file will always be dedicated to that employee. However, if the user goes back to the original template (not a saved employee file) the combobox would be empty since there is name to default in, a blank combobox is approrpriate. "Bob Phillips" wrote: If the value is in the combo list just set the Value property to that cell value ComboBox1.Value = Range("A1").Value -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "TimN" wrote in message ... Is it possible to have a ComboBox with a default value based on say Cell A1 which if there is a name, the name defaults in, otherwise it is blank. All while still having the ability to use the dropdown list in the ComboBox? Thanks for your ideas. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Default Windows Profile without default Office user info | Excel Discussion (Misc queries) | |||
Default ribbon to open by default when opening xls in browser | Excel Discussion (Misc queries) | |||
Default Set up | Excel Discussion (Misc queries) | |||
Default Value? | Excel Programming | |||
CombBox - Object of What Collection? | Excel Programming |