Howdy,
I've used an if statement that creates the name of a .txt file based on a # of inputs that the user will be specifying with drop down arrows. I have assembled a database of these .txt files in a specific folder on my computer. I would like the macro to read the .txt file that is created in the specific cell and then pull that data into excel.
In my first attempt, I tried to accomplish by:
1) Record Macro
2) Copy the text file name from the cell
3) Clicking get data from text/csv
4) Pasting the file name
5) Loading into desired location
6) Stop recording
Now, this macro will run for the specific file that I selected but if the file name changes in the cell that creates the .txt file name by changing the various inputs and then running the macro, it still pulls in the data from the file that was used when creating the macro. I've looked at the VBA code and it looks like instead of creating a situation where it copies from the cell with the .txt file name each time, it just used the original file. I'm not sure how to get around this. I'm pretty new to VBA.
Any thoughts?
Thanks in advance for any help!
I've used an if statement that creates the name of a .txt file based on a # of inputs that the user will be specifying with drop down arrows. I have assembled a database of these .txt files in a specific folder on my computer. I would like the macro to read the .txt file that is created in the specific cell and then pull that data into excel.
In my first attempt, I tried to accomplish by:
1) Record Macro
2) Copy the text file name from the cell
3) Clicking get data from text/csv
4) Pasting the file name
5) Loading into desired location
6) Stop recording
Now, this macro will run for the specific file that I selected but if the file name changes in the cell that creates the .txt file name by changing the various inputs and then running the macro, it still pulls in the data from the file that was used when creating the macro. I've looked at the VBA code and it looks like instead of creating a situation where it copies from the cell with the .txt file name each time, it just used the original file. I'm not sure how to get around this. I'm pretty new to VBA.
Any thoughts?
Thanks in advance for any help!