I wanted to find out which listitem selected in listview on userform to update,add & delete records on worksheet. i dont found any code on net which will help me for this.
i have taken one helper column in worksheet which contain serial numbers, on worksheet Range("M1") display text of Listview item which is selected (basically number of row i.e Sr No)
based on number of row in range("M1") user can update & delete record from worksheet & automatically on listview.
Using worksheet event i refresh the Serial numberCode:Sheet1.Range("M1") = ListView1.SelectedItem.Text
Hope this trick some one will find useful in future, i am posting my solution & excel file hereCode:'sheet 1 code Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim i As Long For i = 2 To Cells(Rows.Count, "B").End(xlUp).Row If Cells(i, "B").Value <> "" Then Cells(i, "A").Value = i - 1 End If Next i End Sub
Userform - Listview Update,Add,Delete Records on worksheet.
ListView_Userform
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA




Reply With Quote
Bookmarks