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: 131
Default Compare Contents of 2 listboxes

Could I please have assistance with the code below, my aim is to compare
contents of ListBox2 with ListBox1 if a match is found to remove it from
ListBox1;

Dim i As Long, j As Long

For i = 0 To ListBox2.ListCount - 1
DoEvents
ListBox2.ListIndex = i
For j = 0 To ListBox1.ListCount - 1
DoEvents
ListBox1.ListIndex = j
If InStr(1, ListBox2.List(ListBox2.ListIndex),
ListBox1.List(ListBox1.ListIndex)) Then
ListBox1.RemoveItem (j)
End If
Next j
Next i

End Sub

 
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 row contents Dylan Excel Programming 7 July 14th 08 09:05 PM
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
COMPARE CELL CONTENTS guy Excel Worksheet Functions 4 December 24th 05 08:29 PM
compare cell contents guy Excel Worksheet Functions 2 December 23rd 05 08:38 PM
How to compare the contents of two rows is the same? OKLover Excel Programming 5 July 3rd 05 04:23 PM


All times are GMT +1. The time now is 05:17 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"