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: 812
Default Compare two lists and producing a third list

Sub NoMatch()
Dim rng1 As Range
Dim rng2 As Range
Dim c1 As Range
Dim c2 As Range
Dim bFound As Boolean
Dim iRow As Integer
Dim iCt As Integer

'change ranges to fit data
Set rng1 = Sheets("Sheet1").Range("a1:a4")
Set rng2 = Sheets("Sheet2").Range("a1:a4")
For iCt = 1 To 2
If iCt = 2 Then
'change ranges to fit data
Set rng2 = Sheets("Sheet1").Range("a1:a4")
Set rng1 = Sheets("Sheet2").Range("a1:a4")
End If
For Each c1 In rng1
bFound = False
For Each c2 In rng2
If c1 = c2 Then
bFound = True
Exit For
End If
Next c2
If bFound = False Then
iRow = iRow + 1
Sheets("Sheet3").Cells(iRow, 1) = c1
End If
Next c1
Next iCt
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
Producing an automated list from a large list Chuckee Excel Worksheet Functions 0 February 26th 07 04:00 PM
Compare 2 columns, and create a list of items that are in both lists ruby2sdy Excel Worksheet Functions 3 October 8th 05 11:04 AM
Can I compare 2 lists to combine duplicate entries in new list? Tinytall Excel Worksheet Functions 0 May 13th 05 04:00 PM
Compare 2 lists and if not on list then delete row Jan[_12_] Excel Programming 0 April 6th 05 05:29 PM
How do I compare 2 lists and show duplicates as a new list? AnaBannana Excel Programming 3 January 7th 05 03:42 PM


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