View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default Compare 2 col listings n append items in A not in B to bottom of B

Hi Max,

Try the following.

Sub AppendMissingData()

Dim rng1 As Range
Dim rng2 As Range
Dim cel As Range
Dim foundCel As Range

With Sheet1
Set rng1 = .Range("B19", _
.Cells(.Rows.Count, "B").End(xlUp))
End With

With Sheet2
Set rng2 = .Range("A3", _
.Cells(.Rows.Count, "A").End(xlUp))
End With

For Each cel In rng1
Set foundCel = rng2 _
.Find(What:=cel.Value, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False)

If foundCel Is Nothing Then

Sheet2.Cells(Sheet2.Rows.Count, "A") _
.End(xlUp).Offset(1, 0) = cel.Value

End If

Next cel
End Sub

--
Regards,

OssieMac