PDA

View Full Version : Solved: User can extend 'RowSource'



tccmdr
06-17-2007, 05:30 AM
Hello again Gurus:hi:

I have a combobox control on a userform that picks up an "EquipmentList" as it's 'RowSource'.

What I want to do is:

If the piece of equipment is not listed in the combobox, then the user can type in the name and the original list extended to include the new item.

i.e extends the 'RowSource':help

mdmackillop
06-17-2007, 06:30 AM
Data is a Dynamic range defined as =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)
Private Sub ComboBox1_AfterUpdate()
Dim Rng As Range, c As Range
Set Rng = Range("Data")
Set c = Rng.Find(ComboBox1)
If c Is Nothing Then
Rng(Rng.Cells.Count).Offset(1) = ComboBox1.Value
End If
End Sub

Private Sub CommandButton1_Click()
MsgBox ComboBox1
End Sub

tccmdr
06-17-2007, 03:37 PM
Thanks Mr.X:friends: