I am sorry I missed the notification for your answer.
A userform is complex entity, results are related to the ability in managing in realtime its components, exploiting their properties and using their events.
If you filter the "RowSource" that populates the listbox then its a little bit tricky to identify wich row has been selected. The safest way is to scan the RowSource area against all the datacolumns of the listbox, but knowing your data structure could suggest alternate (simpler) method. For example, is any column "unique" in your data, so that you can "match" that column only?
Possible ways to speedup your code are:
1) limit the search to the rowsource area
2) avoid cell selection
For example, working with the demo workbook I published:
-when selecting an item in the listbox I populate TextBox2 and TextBox3 with the data from column 1 and column 3
-these TextBoxes can be modified
-I added a button UPDATE; when the button is pressed I use the following code to update the sourcedata:
Code:
Private Sub CommandButton1_Click()
'Manage the UPDATE button:
Dim sRan As Range, tData As Range, cTBt
'
Set sRan = Range(Range("B2"), Range("B2").End(xlDown).End(xlToRight))
If Me.ListBox1.ListIndex >= 0 Then
Set tData = sRan.Find(what:=Me.ListBox1.List(Me.ListBox1.ListIndex, 0), after:=sRan.Cells(1, 1), LookIn:=xlValues, _
lookat:=xlWhole)
If Not tData Is Nothing Then
tData.Offset(0, 0) = Me.TextBox2 'Update Column 1 of the rowsource
tData.Offset(0, 2) = Me.TextBox3 'Update column 3 of the rowsource
End If
'Force repopulating the ListBox:
cTBt = Me.TextBox1.Text
Me.TextBox1.Text = cTBt & " "
Me.TextBox1.Text = cTBt
End If
End Sub
sRan is a reference to the original rowsorce for the Listbox; column B (column1 of the listbox) contains unique values, so I can search only that data and ignore the remaining columns of the listbox.
After the search column1 and column3 of the searched line are modified using the containt of the two textboxes; finally the Listbox is forced to repopulate
The demo file now contains these modification.
As far as the second problem you talk about, I did not understand it. But you should keep in mind that listboxes and comboboxes get populated the same way.
Thus you could reuse the same method I used to populate the listbox in the Sub UserForm_Initialize
Bye