I have a spreadsheet which uses a regular Vlookup function to access data in another workbook called archive.xlsx, saved in the same location as my active workbook. The normal/non-VBA function looks like this and works as intended:
=VLOOKUP(A2,[archive.xlsx]watchlist!A2:L2000,5,FALSE)
I am trying to recreate this in VBA with the goal of being able to run it without having to manually open/close the archive.xlsx file. I'm not very experienced with VBA so I looked at some other posts here asking similar questions and ended up with this line of code (adapted to my own formula) that apparently works for some other users:
Sub Vlookup()
Range("E2") = Application.Vlookup(Range("A2"),([archive.xlsx]watchlist.Range("A2:L2000")),5,FALSE)
End Sub
(the Vlookup result should go to cell E2)
This however gives me a syntax error. I've been looking at this for like an hour now and tried changing dozens of little things but I can't get it to work at all. It's probably something very silly but can anyone see what I'm doing wrong here?