Hi there,
I am trying to match ID#s in column C of Preliminary worksheet to ID#s in column C of Final worksheet. If there is a match, then copy cell content (url links) from column D of Preliminary worksheet to column D of Final worksheet. I am getting a compile error: Object required. Can you please review my code and see where I have gone wrong. Or if this code could be simplified. Thank you so much. File attached.
Sub RangeFind()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastrow1 As Long, lastrow2 As Long, nextrow, c
Application.ScreenUpdating = False
Set ws1 = ThisWorkbook.Sheets("Final")
Set ws2 = ThisWorkbook.Sheets("Preliminary")
Set lastrow1 = ws1.Range("C" & Rows.Count).End(xlUp).Row
Set lastrow2 = ws2.Range("C" & Rows.Count).End(xlUp).Row
'Loop through Preliminary worksheet, Column C
For nextrow = 2 To lastrow1
'Search Final worksheet Column C for value from Import
With ws2.Range("C2:C" & lastrow2)
Set c = .Find(ws2.Range("C" & nextrow), LookIn:=xlValues, LookAt:=xlWhole)
'Copy Preliminary worksheet row if match is found
If Not c Is Nothing Then
ws2.Range("D" & nextrow).Copy _
Destination:=ws1.Range("D" & c.Row)
End If
End With
Next
Application.ScreenUpdating = True
End Sub
Bookmarks