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

    Difficult to import some Variable (2000 r s1)

    Problem:

    When the variable var_CODRUOLO = Mid(riga, 98, 2) is > 01 get the data from the possible line:

    RICODIFICATA FIRMA: SI

    RICODIFICATI POTERI: SI

    REGOLARE RISPETTO ALLA PRIVACY: SI

    REGOLARE RISPETTO ALL'ANTIRICICLAGGIO: SI

    only the value Si or No

    and put into column L,M,N and O

    Here is the txt file for experiment:
    HTTP:www.gssitaly.comL0747.zip

    For example for this piece:


    COPE/NDG: 65421631/300308175 NOMINATIVO: ESPOSITO PASQUALE COD RUOLO: 76 DESCR: PROCURATORE

    RICODIFICATA FIRMA: SI

    RICODIFICATI POTERI: SI

    REGOLARE RISPETTO ALLA PRIVACY: SI

    REGOLARE RISPETTO ALL'ANTIRICICLAGGIO: SI

    get only the for "SI" and put into column L,M,N and O because the var COD RUOLO is 76


    Sorry here is the code: see attachment - HansV

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

    Re: Difficult to import some Variable (2000 r s1)

    Hans, good code ...
    Yuo have repeat the routine make the sheet from variable is corretct?

    And you have comment this line 'Sheets("FOGLIO2").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)

    for the two routine , sorry but i am confused

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

    Re: Difficult to import some Variable (2000 r s1)

    Attachment replaced by HansV

    The flow of the code had to be changed, because the Si/No values have to be read from lines following the line with COPE/NDG. See attachment.

    Note: you should have Option Explicit at the top of all modules, and declare all variables explicitly.

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

    Re: Difficult to import some Variable (2000 r s1)

    Sorry, I forgot to uncomment that line - I didn't want to create new sheets while testing. I have replaced the attachment in my previous reply.

    And yes, a part of the code is repeated at the end, this is needed to process the last record. In the original code, you filled a row in the spreadsheet as soon as a line with COPE/NDG was found. now, you have to wait, for you must still read the Si/No lines. But that means that the last row hasn't been filled yet when the end of the file is reached, so it must be done separately.

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

    Re: Difficult to import some Variable (2000 r s1)

    No prob for "I forgot to uncomment that line..." for you all is permit;-)
    But after the sheet is created how to make it visible?

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

    Re: Difficult to import some Variable (2000 r s1)

    You know how to do that, Sal.

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

    Re: Difficult to import some Variable (2000 r s1)

    Ok solved! for "visible sheet"
    Ahhhhhhhhhh... sorry if you heve downlod my txt file for experiment i have see it is big!
    Tk Hans

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

    Re: why, why, why....

    Hans this is my last code (see txt attached).
    problem:
    I have insert into wbook a sheet named MENU and a button where i have associated your macro L0747_HANS.
    when the macro (module HANS) find the var_DIP the code rename the sheet MENU menu and not recopy the template sheet L0747-FIPO????????????

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

    Re: why, why, why....

    Change the line

    Set Foglio1 = ActiveSheet

    to

    Set Foglio1 = Sheets(ActiveWorkbook.Sheets.Count)

    (compare this with the code in <post#=503,392>post 503,392</post: >). The line "Set Foglio1 = ActiveSheet" won't do what you want because the sheet you just copied is still hidden (it will be made visible two lines further on), so it is not the ActiveSheet.

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

    Re: Difficult to import some Variable (2000 r s1)

    Hans,......... Help me or my head go in fire.
    The macro a time work and other time have this...
    See attaced.
    Only a minute and my head is fired....
    I test this from 4 hours and have many, many, problem with "error 1004"

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

    Re: Difficult to import some Variable (2000 r s1)

    With the modification from <post#=504,801>post 504,801</post: >, the code imports the entire 7836 KB text file from HTTP:www.gssitaly.comL0747.zip without problems.

Posting Permissions

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