Prevent duplicates from adding items from Listbox1 to Listbox2
I have two ListBoxes. ListBox1 has list of items that can be selected by the user to transfer to ListBox2 by either double clicking the item or pressing the add button. What I want to do now is to prevent the user from adding duplicates in ListBox2. If ever a duplicate is detected a message will prompt "Item already included" and end the code. I am guessing this can be done with contains? But I have no idea how to do it. I have the following codes: 'Report Listing Private Sub UserForm_Initialize() 'List of Reports With ListBox1 .AddItem "Report 1" .AddItem "Report 2" .AddItem "Report 3" .AddIt
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.