Results 1 to 3 of 3
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IMPORT string from txt (2000)

    I have this line in text file:

    SPORTELLO: 0500 CONTO: 000000 TIPO PROD: 0040 DESCR: CONTI CORRENTI ORDINARI DT.ATTIV. 01.09.2006

    end i get the data from:

    If Mid(RIGA, 10, 10) = "SPORTELLO:" Then
    ecc...

    now in a column A and B have:

    0500 PUGLIA
    0501 PUGLIA
    0502 PUGLIA
    0503 PUGLIA
    0504 PUGLIA
    0505 PUGLIA
    0506 PUGLIA
    0507 PUGLIA
    0543 PUGLIA
    0546 PUGLIA
    0549 PUGLIA
    0552 PUGLIA
    0555 PUGLIA
    0558 PUGLIA
    0561 PUGLIA
    0564 PUGLIA
    0567 PUGLIA
    0570 PUGLIA
    0576 PUGLIA
    0579 PUGLIA
    0580 PUGLIA
    0582 PUGLIA
    2900 PUGLIA
    2911 PUGLIA
    2943 PUGLIA
    2946 PUGLIA
    2949 PUGLIA
    3700 PUGLIA
    3701 PUGLIA
    3743 PUGLIA
    3752 PUGLIA
    3755 PUGLIA
    3758 PUGLIA
    6800 PUGLIA
    6801 PUGLIA
    6803 PUGLIA
    6804 PUGLIA
    6805 PUGLIA
    6811 PUGLIA
    6843 PUGLIA
    6846 PUGLIA

    i want to intercept the text line only if the string SPORTELLO: XXXX where XXXXX is present in the column A

    in this case i restrict the reading lines of text

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: IMPORT string from txt (2000)

    Try this:

    Dim strCode As String
    Dim rngFind As Range
    If Mid(RIGA, 10, 10) = "SPORTELLO: " THEN
    ' Extract 4 digit code
    strCode = Mid(RIGA, 21, 4)
    Set rngFind = Range("A:A").Find(What:=strCode, LookAt:=xlWhole, LookIn:=xlValues)
    If rngFind Is Nothing Then
    ' Not found
    Else
    ...
    End If
    End If

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: IMPORT string from txt (2000)

    EXCELLENT!
    tks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •