Hi StrugInPP
Place the two attached files in the same folder. Run the code from the button in Worksheet1. Let me know of issues.
Option Explicit
Sub Update_Book()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim Rng1 As Range
Dim Rng2 As Range
Dim cel As Range
Dim LR As Long
Dim LC As Long
Dim myPath As String
Dim wasOpen As Boolean
myPath = ThisWorkbook.Path & "\"
Set wb1 = ThisWorkbook
Set ws1 = wb1.Sheets("Sheet1")
On Error Resume Next
Set wb2 = Workbooks.Open(myPath & "worksheet 2.xlsx")
Set ws2 = wb2.Sheets("Sheet1")
On Error GoTo 0
Application.ScreenUpdating = False
If wb2 Is Nothing Then
Set wb2 = Workbooks.Open(Workbooks.Open(myPath & "worksheet 2.xlsx"))
Else
wasOpen = True
End If
With ws2
LC = .Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column + 1
End With
With ws1
LR = .Range("C" & .Rows.Count).End(xlUp).Row
Set Rng1 = .Range("C2:C" & LR)
For Each cel In Rng1
With ws2.Columns("A:A")
Set Rng2 = .Find(What:=cel, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng2 Is Nothing Then
ws2.Cells(Rng2.Row, LC).Value = ws1.Cells(cel.Row, 11).Value
End If
End With
Next cel
End With
Application.ScreenUpdating = True
End Sub
Bookmarks