Quick question which isn't a massive issue, just an annoying little thing.
When I run a certain macro, which vlookups within a different excel file, sometimes but not every time, I get prompted to select the file to copy from as shown in the screenshot.
The required file is the first in the list, it never gets renamed or moved:
I've also attached a screenshot of the macro code, it'd be great if someone could help me in having it so it runs without me having to select the file most times.
I know I don't have a full path to the file, I tried that but then it stopped worked so I'm not sure?
Range("A1").Select
Sheets.Add After:=ActiveSheet
Sheets("Sheet2").Select
ActiveCell.FormulaR1C1 = "=IF(LEFT(Sheet1!RC,2)=""91"",Sheet1!RC,"""")"
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A100")
Range("B1").Select
ActiveCell.FormulaR1C1 = _
"=IF(VLOOKUP(MID(RC[-1],3,6),[StockQuantity.xlsm]Sheet7!C2:C10,9,FALSE)=0,"""",CONCATENATE(""89"",RIGHT(RC[-1],8)))"
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:B100")
Columns("B:B").Select
Selection.Copy
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Columns("A:B").Select
Selection.Delete Shift:=xlToLeft
I don't know why sometimes I don't have to select the file on occasion.