C
Collywobbles
I have been asked by a friend to complete this and Im having difficulty with
it. He wants to see if a number value in each cell of Sheet1.ColumnE is in
any of the cells of Sheet2.ColumnE. If it is not then print the whole row
(from Sheet1) to Sheet3 (next available row). I have tried the following
code but it only returns the unique values in Sheet1.ColumnE and not the
whole row from Sheet1.
This would be easy via MS Access but he can't use that!
Cheers
Killian
---------------
Sub RunMe()
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Dim cll As Range
Set sht1 = Worksheets("Sheet1")
Set sht2 = Worksheets("Sheet2")
Set rng1 = sht1.Range(sht1.Cells(1, 5), sht1.Cells(65536, 5).End(xlUp))
Set rng2 = sht2.Range(sht2.Cells(1, 5), sht2.Cells(65536, 5).End(xlUp))
For Each cll In rng1.Cells
If rng2.Find(cll.Value, LookAt:=xlWhole) Is Nothing Then
Worksheets("Sheet3").Cells(65536, 5).End(xlUp).Offset(1).Value = cll.Value
End If
Next cll
End Sub
it. He wants to see if a number value in each cell of Sheet1.ColumnE is in
any of the cells of Sheet2.ColumnE. If it is not then print the whole row
(from Sheet1) to Sheet3 (next available row). I have tried the following
code but it only returns the unique values in Sheet1.ColumnE and not the
whole row from Sheet1.
This would be easy via MS Access but he can't use that!
Cheers
Killian
---------------
Sub RunMe()
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim rng1 As Range
Dim rng2 As Range
Dim cll As Range
Set sht1 = Worksheets("Sheet1")
Set sht2 = Worksheets("Sheet2")
Set rng1 = sht1.Range(sht1.Cells(1, 5), sht1.Cells(65536, 5).End(xlUp))
Set rng2 = sht2.Range(sht2.Cells(1, 5), sht2.Cells(65536, 5).End(xlUp))
For Each cll In rng1.Cells
If rng2.Find(cll.Value, LookAt:=xlWhole) Is Nothing Then
Worksheets("Sheet3").Cells(65536, 5).End(xlUp).Offset(1).Value = cll.Value
End If
Next cll
End Sub