Combo Box initial values question

  • Thread starter Thread starter teepee
  • Start date Start date
T

teepee

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
 
thanks for trying.
says 'invalid use of me keyword.'

Hi Teepee,

Try something like:

Me.ComboBox1.ListIndex = 0
 
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.
 
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?
 
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.
 
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???
 
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
'<<=============
 
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.
 
Back
Top