Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Windows Profile without default Office user info Karen Excel Discussion (Misc queries) 0 November 12th 08 04:53 PM
Default ribbon to open by default when opening xls in browser Hank Excel Discussion (Misc queries) 0 April 10th 08 10:12 PM
Default Set up Gor_yee Excel Discussion (Misc queries) 6 January 8th 07 11:46 AM
Default Value? HotRod Excel Programming 2 April 18th 05 01:50 PM
CombBox - Object of What Collection? George Excel Programming 7 February 10th 04 12:01 AM


All times are GMT +1. The time now is 01:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"