SKIP line if contain 3 value

User avatar
sal21
PlatinumLounger
Posts: 4497
Joined: 26 Apr 2010, 17:36

SKIP line if contain 3 value

Post by sal21 »

i read a txt file line by line with the typical Line Input #1, LINEA

based:

Dim LINEA as String

LINEA="kkjkhk retta casa palazzo"

now i need to skip this line, during the loop, if contain retta or casa or palazzo

possible?

User avatar
HansV
Administrator
Posts: 79447
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: SKIP line if contain 3 value

Post by HansV »

Code: Select all

        If LINEA Like "*retta*" Or LINEA Like "*casa*" Or LINEA Like "*palazzo*" Then
            ' Skip this line
        Else
            ' Do something with this line
            ' ...
        End If
Best wishes,
Hans

snb
5StarLounger
Posts: 614
Joined: 14 Nov 2012, 16:06

Re: SKIP line if contain 3 value

Post by snb »

Code: Select all

Sub M_snb()
  sn=filter(filter(filter(split(createobject("scripting.filesystemobject").opentextfile("G:\OF\example.txt").readall,vbcrlf),"retta",0),"casa",0),"palazzo",0)
  cells(1).resize(ubound(sn))=application.transpose(sn)
End sub