I have edited the code but it might not help very much. The line in red font is effective only if the workbook is already open. If it is not already open then it would need to be like this:
Set wkb = Workbooks.Open(ThisWorkbook.Path & "\" & Target.Value & ".xls"
to open the workbook and set the object variable. Also, I note the file extension is .xls but your sample files are posted as .xlsx and .xlsm, so that might also need editing.
Private Sub Worksheet_Change(ByVal Target As Range)
'Find last row with data in Col C
With ActiveSheet
a = .Cells(.Rows.Count, "C").End(xlUp).Row
'Set Cells that will cause an alert when they are changed.
Set KeyCells = .Range("C2:C" & a)
'Exit Macro if more than one cell is chosen
If Target.Count > 1 Then Exit Sub
'Run Macro if one cell in Col C changes
If Not Application.Intersect(KeyCells, Target) Is Nothing Then
'Set workbook "selected" in the target cell, and add ".xls" as extension ***throws a "RuntIme Error 424 - Object Required"***
Set wkb = Target.Value & ".xls"
'Set sheet 1 of that workbook as the sheet to check
Set wks = wkb.Sheet1
'Find the relevant file for whichever Supplier is selected in the Target cell, find the Product in the Supplier Col A matching Col B on the Target row, copy the value from Supplier Col B into Col D of the Target row in the ORDERS file
Target.Offset(0, 1) = Application.WorksheetFunction.Index(wks.Range("B:B"), Application.WorksheetFunction.Match(Target.Offset(0, -1), wks.Range("A:A"), 0))
End If
End With
End Sub
P.S. Using Range(Target.Address) is a redundant expression. Target is a range, so that is all you need when referring to that range.
Bookmarks