Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am working with a script to try and return non matches. I have set up two ranges and have set up nested loops to compare them. The problem I'm currently having is that, even with the operator set to "<", even the matches get returned for some reason. Does anyone have any ideas as to why this would do that? (Script below) Thanks very much, Louis ====================== Sub Find_Matches() Dim CompareRange1 As Variant, x1 As Variant, y1 As Variant Dim CompareRange2 As Variant, x2 As Variant, y2 As Variant ' Set CompareRange equal to the range to which you will ' compare the selection. Set CompareRange1 = Worksheets("Sheet1").Range("A1:A5") Set CompareRange2 = Worksheets("Sheet2").Range("A1:A5") ' Loop through each cell in the selection and compare it to ' each cell in CompareRange. For Each x1 In CompareRange1 For Each y2 In CompareRange2 If x1 < y2 Then x1.Offset(0, 1) = x1 Next y2 Next x1 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If value matches criteria, return formula | Excel Worksheet Functions | |||
Return value of non matches in columns | Excel Discussion (Misc queries) | |||
Count values only if matches and return on another worksheet | Excel Worksheet Functions | |||
How do I use lookup to return multiple matches and sum them? | Excel Discussion (Misc queries) | |||
Vlookup to return the sum of multiple matches | Excel Discussion (Misc queries) |