combobox doesn't load cell value at startup

C

Charlie

I've got my combobox to apply the change made to it immediately with:
Private Sub ComboBox1_Change()
Worksheets("sheet1").Range("C16") = Me.ComboBox1.Value
End Sub
....and I leave the controlsource empty

But now, when the form loads, it doesn't load the cell value back into the
combobox, it's just blank... How do I adjust this?
 
M

merjet

Private Sub UserForm_Initialize()
If Worksheets("sheet1").Range("C16") <> "" Then
For Each c In Range(ComboBox1.RowSource)
If c = Worksheets("sheet1").Range("C16") Then
ComboBox1.Value = c
Exit Sub
End If
Next c
End If
End Sub

Hth,
Merjet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top