Hi,
I want to write a formula in a cell on a worksheet using <acronym title="visual basic for applications">vba</acronym>.
The formula holds an path name for a certain folder.
I can get the data out of the file in the folder, but it seems that excel doesn't find the file (File_Name), since I got a window showing the folder data and I have to click the right file.
How can I solve this?
FolderName is a string and Item_Name is an integer
File_Name is not a variable but the actual name of the file
This is the code I've used:
Worksheets("Test").Cells(1, 1).Formula = "=INDEX('" & FolderName & "\[File_Name " & Item_Name & ".xlsx]Sheet1'!$1:$1048576,MATCH(Sheet1!B5,'" & Folder & "\[File_Name " & Item_Name & ".xlsx]Sheet1'!$A:$A,0),11)"
Thanks for the responses!
I want to write a formula in a cell on a worksheet using <acronym title="visual basic for applications">vba</acronym>.
The formula holds an path name for a certain folder.
I can get the data out of the file in the folder, but it seems that excel doesn't find the file (File_Name), since I got a window showing the folder data and I have to click the right file.
How can I solve this?
FolderName is a string and Item_Name is an integer
File_Name is not a variable but the actual name of the file
This is the code I've used:
Worksheets("Test").Cells(1, 1).Formula = "=INDEX('" & FolderName & "\[File_Name " & Item_Name & ".xlsx]Sheet1'!$1:$1048576,MATCH(Sheet1!B5,'" & Folder & "\[File_Name " & Item_Name & ".xlsx]Sheet1'!$A:$A,0),11)"
Thanks for the responses!