ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box initial values question (https://www.excelbanter.com/excel-programming/389293-combo-box-initial-values-question.html)

teepee

Combo Box initial values question
 
Does anyone know how to make a combo box show a value when a sheet opens?
Mine are always blank when I open them until I select a value.

thanks

tp



Norman Jones

Combo Box initial values question
 
Hi Teepee,

Try something like:

Me.ComboBox1.ListIndex = 0


---
Regards,
Norman


"teepee" wrote in message
...
Does anyone know how to make a combo box show a value when a sheet opens?
Mine are always blank when I open them until I select a value.

thanks

tp





teepee

Combo Box initial values question
 
thanks for trying.
says 'invalid use of me keyword.'

"Norman Jones" wrote in message
...
Hi Teepee,

Try something like:

Me.ComboBox1.ListIndex = 0


---
Regards,
Norman


"teepee" wrote in message
...
Does anyone know how to make a combo box show a value when a sheet opens?
Mine are always blank when I open them until I select a value.

thanks

tp






Norman Jones

Combo Box initial values question
 
Hi Teepee,

Where is your code?

I assumed that the combobox code would be either
in a userform module or a worksheet module, in which
case the keyword would not cause a problem and would
refer to the userform or the sheet holding the code.


---
Regards,
Norman


"teepee" wrote in message
...
thanks for trying.
says 'invalid use of me keyword.'

"Norman Jones" wrote in message
...
Hi Teepee,

Try something like:

Me.ComboBox1.ListIndex = 0


---
Regards,
Norman


"teepee" wrote in message
...
Does anyone know how to make a combo box show a value when a sheet
opens?
Mine are always blank when I open them until I select a value.

thanks

tp








Dave Peterson

Combo Box initial values question
 
What kind of combobox is it?

A dropdown from the Forms toolbar--or a combobox from the Control toolbox
toolbar?

And where did you put the code?

teepee wrote:

thanks for trying.
says 'invalid use of me keyword.'

"Norman Jones" wrote in message
...
Hi Teepee,

Try something like:

Me.ComboBox1.ListIndex = 0

---
Regards,
Norman

"teepee" wrote in message
...
Does anyone know how to make a combo box show a value when a sheet opens?
Mine are always blank when I open them until I select a value.

thanks

tp



--

Dave Peterson

teepee

Combo Box initial values question
 
Hi

It is a control toolbox comb box. I tried executing Norman's code on the
page - giving the error described above - and inside the box, where it just
did nothing.



Dave Peterson

Combo Box initial values question
 
And you placed the code behind the worksheet--not in a general module, not in
the ThisWorkbook module?

You may want to share more of the code.

Did you put it in the worksheet_activate event or something else???

teepee wrote:

Hi

It is a control toolbox comb box. I tried executing Norman's code on the
page - giving the error described above - and inside the box, where it just
did nothing.


--

Dave Peterson

Norman Jones

Combo Box initial values question
 
Hi Tepee,

The following code in ths worksheet module worked foe me:

'=============
Private Sub Worksheet_Activate()
With Me.ComboBox1
.ListFillRange = "A1: A10"
.ListIndex = 0
End With
End Sub
'<<=============



---
Regards,
Norman


"teepee" wrote in message
...
Hi

It is a control toolbox comb box. I tried executing Norman's code on the
page - giving the error described above - and inside the box, where it
just
did nothing.





teepee

Combo Box initial values question
 

"Norman Jones" wrote in message
...
Hi Tepee,

The following code in ths worksheet module worked foe me:

'=============
Private Sub Worksheet_Activate()
With Me.ComboBox1
.ListFillRange = "A1: A10"
.ListIndex = 0
End With
End Sub
'<<=============


many thanks norman - that worked a treat.




All times are GMT +1. The time now is 12:15 PM.

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