The below formula has a defined path '[TOC Model.xlsm]Partlist'!. This makes it choose a specific worksheet in a specific file. I need a vba code that can replace the hardcoded path with a user defines file chooser. The worksheet tab name (Partlist) remains the same
Range("B2").Select
Selection.FormulaArray = _
"=IFERROR(INDEX('[TOC Model.xlsm]Partlist'!R2C2:R10000C2,SMALL(IF(RC[-1]='[TOC Model.xlsm]Partlist'!R2C1:R10000C1,ROW('[TOC Model.xlsm]Partlist'!R2C1:R10000C1)-1),ROWS(R2C:RC))),"""")"
Selection.AutoFill Destination:=Range("B2:B5037")
Range("B2:B5037").Select
Solved by A. E. in 14 mins