LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Compare & return missing values

Hi Stephen

Another way to do it listed below.

Option Explicit
Dim MyCell, MyRng1, MyRng2 As Range
Dim FoundCell As Range
Dim c As Integer
Private Sub CommandButton1_Click()

Worksheets("Compare").Activate

Set MyRng1 = Range("H2:H" & [G65535].End(xlUp).Row)
Set MyRng2 = Range("D6:D" & [D65535].End(xlUp).Row)

For Each MyCell In MyRng1

Set FoundCell = MyRng2.Find(What:=MyCell, LookAt:=xlWhole)

If FoundCell Is Nothing Then

c = Worksheets("Results").[D65535].End(xlUp).Row + 1

Worksheets("Results").Cells(c, 4).Value = _
MyCell.Offset(0, -1).Value
Worksheets("Results").Cells(c, 5).Value = _
MyCell.Value

End If

Next MyCell

End Sub

Hope this helps

 
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 Value in Cell 1 to a List, Return Value if Match otherwise Return Null Ben Excel Discussion (Misc queries) 2 March 15th 07 01:02 AM
Compare two worksheets for missing information Naba via OfficeKB.com Excel Worksheet Functions 6 July 7th 06 05:46 PM
Compare two workbooks and Copy missing data Naba Excel Programming 0 June 29th 06 06:59 AM
Excel Compare values in columns & display missing values in a new cpetta Excel Discussion (Misc queries) 1 April 2nd 05 05:51 AM
Macro to compare values and return exact matching value [email protected] Excel Programming 1 January 2nd 04 11:59 PM


All times are GMT +1. The time now is 05:26 PM.

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"