K
Kazza
Hi All
The code below will match Sheets 1 and 2 and when a match occurs copy
cells from sheet 2 to 1.
I need to copy the entire row of the unmatched items over to sheet 1 at
the same time. Hope this makes sense.
TIA
Karen
Sub Match()
Dim lookupRange As Range
Dim myRange As Range
Dim cell As Range
Dim myRow As Variant
Set lookupRange = Sheets("Sheet2").Range("a:a")
With Sheets("Sheet1")
Set myRange = .Range("a2:a" & .Range("a" &
Rows.Count).End(xlUp).Row)
End With
For Each cell In myRange
myRow = Application.Match(cell.Value, lookupRange, 0)
If Not IsError(myRow) Then cell.Offset(0, 1).Resize(1, 22).Value =
_
lookupRange(myRow).Offset(0, 1).Resize(1, 22).Value
Next cell
End Sub
The code below will match Sheets 1 and 2 and when a match occurs copy
cells from sheet 2 to 1.
I need to copy the entire row of the unmatched items over to sheet 1 at
the same time. Hope this makes sense.
TIA
Karen
Sub Match()
Dim lookupRange As Range
Dim myRange As Range
Dim cell As Range
Dim myRow As Variant
Set lookupRange = Sheets("Sheet2").Range("a:a")
With Sheets("Sheet1")
Set myRange = .Range("a2:a" & .Range("a" &
Rows.Count).End(xlUp).Row)
End With
For Each cell In myRange
myRow = Application.Match(cell.Value, lookupRange, 0)
If Not IsError(myRow) Then cell.Offset(0, 1).Resize(1, 22).Value =
_
lookupRange(myRow).Offset(0, 1).Resize(1, 22).Value
Next cell
End Sub