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

    Very difficult to replece a value... (2000 sr 1)

    i import many value from a txt file with the attached macro.
    Have a prob (naturally;-))
    In a part of txt file is present a value:

    , 1
    , 5
    , 8

    I would want to transform this value if is present and during the import in:

    0,01
    0,05
    0,08
    ...

    Naturally if this condition not existis for other case skip...

    I get the value from:

    DARE = Trim(Mid(RECORD_CORRENTE, 19, 16))
    AVERE = Trim(Mid(RECORD_CORRENTE, 40, 16))

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

    Re: Very difficult to replece a value... (2000 sr 1)

    Attachment from deleted other thread. Contains workbook.

    (You shouldn't start a new thread to post an attachment for an existing thread)

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

    Re: Very difficult to replece a value... (2000 sr 1)

    Use this:
    <code>
    Dare = Replace(Trim(Mid(Record_Corrente, 19, 16)), " ", "0")
    Avere = Replace(Trim(Mid(Record_Corrente, 40, 16)), " ", "0")
    </code>
    To avoid the problems with numbers being interpreted as text, put them in the spreadsheet as follows:
    <code>
    Elenco.Range("I" & Cont).Value = CDbl(Dare)
    Elenco.Range("J" & Cont).Value = CDbl(Avere)</code>

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

    Re: Very difficult to replece a value... (2000 sr 1)

    Super GREAT!
    Hans, still tks, for solution of NUMBER formt in TEXT, with the current suggestion i have solved...

    Note: i have used, with your suggestion the instruction REPLACE, but i not have undestand that instruction find in all part of string in every case, and not i a declared posistion... Good Very Good!!!!!
    Excellent...
    For me this solution is very,very good, because i work frequently with a text file...
    Tks brother...

Posting Permissions

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