I am trying to check whether the values in workbook1-sheet1-A are matched in workbook2-sheet2-E. If there is a match workbook1-sheet1-Y receives a 'x'.
This is the code I have so far and gives me Run time error 424 - Object required error on the if loop.
Sub Check()
'
Application.ScreenUpdating = False
endRow = Range("A" & Rows.Count).End(xlUp).Row
wkbSLA = ("F:\Workbook2")
For i = 2 To endRow
If Cells(i, 1).Value = wkbSLA.Sheets("Sheet2").Range("E2:E575").Value Then
Range("Y" & i) = "x"
End If
Next i
'
End Sub
To ensure your code is doing everything you expect it to it, make sure you qualify your objects with variables.
Also, you cannot use the
.Valueproperty on multi-cell range. That is probably where your error is hitting. A better way to approach this is with the.Findmethod.If you write the code something like this, it should work for you … though you may need to tweak it a bit to meet your needs.