Sub Demo()
Const FOLD$ = "D:\Test4Noob\", HDR$ = "-Chromosome "
ChDrive FOLD: ChDir FOLD
FINP = Application.GetOpenFilename("Text files , *.txt", , " Select a text file :")
If FINP = False Then Exit Sub
HL& = Len(HDR)
FR% = FreeFile: Open FINP For Input As #FR
FW% = FreeFile: Open FOLD & "output.txt" For Output As #FW
Do While Not EOF(FR)
Line Input #FR, TL$
If TL > "" Then
If B% Then B = Left(TL, 1) <> "-"
If B = 0 Then If Left(TL, HL) = HDR Then B = Val(Mid(TL, HL + 1)) <> 1
If B = 0 Then Print #FW, TL
End If
Loop
Close
End Sub
Standard VBA statements that you can find out in inner help …
And don't forget to click on bottom left star "Add Reputation", thanks !
Bookmarks