ComboBox Issue: Write to WorkSheet

  • Thread starter Thread starter Paul Martin
  • Start date Start date
P

Paul Martin

Hi All

I have a ComboBox on a UserForm. The TextBoxes on the form are
populated according to the ComboBox selection, using the Change event
of the ComboBox.

The user can change the values in the ComboBox, and I want these
changes to be stored on a hidden worksheet so that these repopulate the
ComboBox when needed. I thought I'd change the ComboBox's
ControlSource on the AfterUpdate event, but by this stage ListIndex has
been lost (reverted to -1).

I've tried using other events, but am getting nowhere. Any
suggestions?

Thanks in advance

Paul Martin
Melbourne, Australia
 
Private Sub Combobox1_Click()
Dim rng as Range, idex as Long
sStr = Combobox1.RowSource
set rng = Range(Combobox1.RowSource)
idex = Combobox1.ListIndex
Combobox1.RowSource = ""

' make your changes,
' then reset the rowsource. Determine new one or use sStr
Combobox1.RowSource = "something"

End Sub
 
OK, I didn't think about clearing RowSource. Simple, but clever.

Thanks Tom

Paul Martin
Melbourne, Australia
 
Back
Top