Hello friends,
I use the following code to import all of the .txt files in a directory into the "Import" sheet of my workbook.
Please Login or Register to view this content.
I run this process twice, using two different workbooks to import two different file types (both .txt, just containing different data sets) and I recently decided I would like to try and combine them into one operation. What I'd like to do is add an IF condition to my Import code such as:
IF the file name contains "confirm" THEN import to Sheets("Confirm") ELSE import to Sheets("Import")
For example, if my directory contains the following files:
7515F01_120511_05-10_191510.txt
7515F01_120512_05-10_191510.txt
7515F01_120513_05-10_191510.txt
7515F01_120511_confirm_05-10_191510.txt
7515F01_120512_confirm_05-10_191510.txt
7515F01_120512_confirm_05-10_191510.txt
The top three would go to the "Import" sheet and the bottom three would go to the "Confirm" sheet.
My VBA skills are, how do you say... developing, so any guidance is greatly appreciated.
Thank you.
Bookmarks