Finding files that DON'T end in (1)

dancingcab

New Member
Joined
Nov 10, 2014
Messages
14
Hi,

My instrument spits out two text files of raw data. The analysis I need to perform is depended on which of the two files I'm looking at. The text files have the same filename however the 2nd file has (1) at the end. I can loop through half the files using

sFile = Dir(sPath & Application.PathSeparator & "*(1).txt")

But how do I loop through all the other files? Any ideas? The filename could be anything entered by the user so I don't have any more information about it other than it doesn't end in (1).

Any help would be much appreciated.

Thanks!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Assuming all the files of interest are text files, maybe something like this:

Code:
sFile = Dir(sPath & Application.PathSeparator & "*.txt")
If InStr(sFile, "(1)") > 0 Then
    'call a routine for the (1) type files
Else
    'call a routine for the other .txt files
End If
 
Upvote 0

Forum statistics

Threads
1,215,284
Messages
6,124,067
Members
449,140
Latest member
SheetalDixit

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top