Addo Well-Known Member Licensed User Longtime User Mar 11, 2021 #1 Is there any way to delete custom list view item by its value not index?
mangojack Expert Licensed User Longtime User Mar 12, 2021 #2 This will work fine where all CLV Item values are unique .. Code: Copy RemoveItemByValue(myValue) Sub RemoveItemByValue(Val As Object) For i = 0 To clv1.Size -1 If Val = clv1.GetValue(i) Then clv1.RemoveAt(i) Return End If Next End Sub If you wish to remove multiple items (with same value) you would want to loop from the end of list ... and remove the Return call ... Code: Copy For i = clv1.Size -1 To 0 Step -1 Upvote 0
This will work fine where all CLV Item values are unique .. Code: Copy RemoveItemByValue(myValue) Sub RemoveItemByValue(Val As Object) For i = 0 To clv1.Size -1 If Val = clv1.GetValue(i) Then clv1.RemoveAt(i) Return End If Next End Sub If you wish to remove multiple items (with same value) you would want to loop from the end of list ... and remove the Return call ... Code: Copy For i = clv1.Size -1 To 0 Step -1