Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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
compare the contents of one range of cells with the contents of a. Dozy123 Excel Discussion (Misc queries) 1 January 24th 07 10:14 AM
Edit cell contents via userform listbox N E Body[_14_] Excel Programming 1 October 22nd 04 01:44 AM
Compare Cells on Sheet to ListBox Selection NNexcel Excel Programming 1 October 5th 04 06:46 PM
print listbox contents Dave Peterson[_3_] Excel Programming 1 August 26th 03 04:13 AM
Copying contents of a listbox B[_2_] Excel Programming 0 August 7th 03 02:55 PM


All times are GMT +1. The time now is 02:33 AM.

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

About Us

"It's about Microsoft Excel"