I'd like to open all ".txt" files in a folder one by one to extract data into a worksheet - would someone have some code which does this or something similar please? Thanks in advance!
I'd like to open all ".txt" files in a folder one by one to extract data into a worksheet - would someone have some code which does this or something similar please? Thanks in advance!
Here's a macro I've got that imports XLS files as separate sheets. If you use the macro recorder to record you opening ONE of your text files, you could probably mix that code with this to get a macro that does what you need.
![]()
Please Login or Register to view this content.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Thanks for that - I've got something similar but remember seeing some code to loop through all the files in a folder until it reaches the end, which is what
I'm stuck on at the moment. The help file is no help on this one as far as I can see![]()
Hello jp001,
Do you mean to search all subfolders within the folder, and then all subfolders of the subfolders till there are no more?
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi
The macro in this link
http://www.excelforum.com/excel-prog...ets-macro.html
opens each text file and imports to excel. Give it a try.
Ravi
Thanks Ravi, but this is what I was looking for, simple and elegant:
![]()
Please Login or Register to view this content.
Last edited by jp001; 08-08-2009 at 01:50 AM. Reason: addendum
No one can be offended with a simple:
"This is what I was looking for. Thanks for your help anyway."
Your version...very easy to be put off by.
============
Anyway. if that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks