LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 989
Default Add item to listbox, but only if it is not already there.

I am trying to write code so that if an item is selected in one listbox, it
will be added to another listbox. However, it should only be added if it
does not already exist in the second listbox.

Why is the following code doing nothing. It make logical sense, to me.

For i = 0 To UserForm1.ColumnSelect.ListCount - 1
If UserForm1.ColumnSelect.Selected(i) Then
For j = 0 To UserForm1.ColFilter.ListCount
If UserForm1.ColumnSelect.List(i) <
UserForm1.ColFilter.List(j) Then
UserForm1.ColFilter.AddItem UserForm1.ColumnSelect.List(i)
End If
Next j
End If
Next i
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Last Item of Listbox not getting displayed Raj Excel Discussion (Misc queries) 0 April 22nd 08 10:58 AM
Item order in ListBox [email protected] Excel Discussion (Misc queries) 1 June 16th 06 01:15 PM
listbox remove Item Simon Shaw Excel Programming 3 July 3rd 05 10:14 PM
Opening item from Listbox... Need Help :P jaysen[_3_] Excel Programming 14 June 25th 05 10:23 PM
The value of a ListBox Item TK Excel Programming 2 August 20th 04 06:17 AM


All times are GMT +1. The time now is 03:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"