Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare multiple listbox contents
Hi everyone, Im hoping someout out there can help me with this one. I have two listboxes, i want to create a third one based on the results of the contents of the other two. EG :- Listbox three shows everything that is different between listbox 1 and 2. So if listbox 1 has :- a,b,c,d,e,f,g & listbox 2 has :- b,c,e,f I need listbox three to show :- a,d,g etc etc. has anybody done this, and can anybody help please ??. -- TASDEVIL ------------------------------------------------------------------------ TASDEVIL's Profile: http://www.excelforum.com/member.php...o&userid=23109 View this thread: http://www.excelforum.com/showthread...hreadid=474637 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Compare multiple listbox contents
Dim i As Long, j As Long
Dim fMatch As Long For i = 1 To ListBox1.ListCount fMatch = False For j = 1 To ListBox2.ListCount If ListBox1.List(i - 1) = ListBox2.List(j - 1) Then fMatch = True Exit For End If Next j If Not fMatch Then ListBox3.AddItem ListBox1.List(i - 1) End If Next i For i = 1 To ListBox2.ListCount fMatch = False For j = 1 To ListBox1.ListCount If ListBox2.List(i - 1) = ListBox1.List(j - 1) Then fMatch = True Exit For End If Next j If Not fMatch Then ListBox3.AddItem ListBox2.List(i - 1) End If Next i -- HTH Bob Phillips "TASDEVIL" wrote in message ... Hi everyone, Im hoping someout out there can help me with this one. I have two listboxes, i want to create a third one based on the results of the contents of the other two. EG :- Listbox three shows everything that is different between listbox 1 and 2. So if listbox 1 has :- a,b,c,d,e,f,g & listbox 2 has :- b,c,e,f I need listbox three to show :- a,d,g etc etc. has anybody done this, and can anybody help please ??. -- TASDEVIL ------------------------------------------------------------------------ TASDEVIL's Profile: http://www.excelforum.com/member.php...o&userid=23109 View this thread: http://www.excelforum.com/showthread...hreadid=474637 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
compare the contents of one range of cells with the contents of a. | Excel Discussion (Misc queries) | |||
Edit cell contents via userform listbox | Excel Programming | |||
Compare Cells on Sheet to ListBox Selection | Excel Programming | |||
print listbox contents | Excel Programming | |||
Copying contents of a listbox | Excel Programming |