Page 9 of 9 FirstFirst ... 789
Results 81 to 86 of 86

Thread: Copy Paste based on comparisons calculations in 2 XL files, 1 might be .csv file .Opened in XL=Fail/Chaos

  1. #81

  2. #82
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    OK, good, I see the problem.
    I will post the solution later .
    A Folk, A Forum, A Fuhrer ….

  3. #83
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    The problem is that text files cannot be analysed by a worksheet type way for like last row
    Lr= ….. .End(Xlup).row ….… and so on. That does not work in a text file. We do not have rows in a text file

    In a text file, we talk about instead lines and records

    Excel file row is only approximately = Text file line or Text file record

    In text file for last record, or last line, we use
    EOF ( https://docs.microsoft.com/en-us/off...p/eof-function )

    Or

    we do it another way. Your file in post#1 was like
    NSE, ,
    NSE, ,
    NSE, ,
    , ,
    , ,
    , , Explanation etc .


    So I did do check for “NSE,” for last data that you wanted

    So for no extra lines like below, like in sample2BEFORE.csv , it does not work too well
    NSE, ,
    NSE, ,
    NSE, ,


    ( See here for more info, just for info, not important :
    Original text files : https://excelfox.com/forum/showthrea...ge32#post13475
    https://excelfox.com/forum/showthrea...ge32#post13476

    Text files post#29 : https://excelfox.com/forum/showthrea...ll=1#post13618
    )




    So solution to this problem
    Change .._
    Code:
        Do While Left(TextFileLineIn, 4) = "NSE," ' For text file lines like   NSE,101010,6,<,12783,A,,,,,GTT that may have extra unwanted lines like in one Avinash uses stupidly for explanations
         Let RwCnt = RwCnt + 1
         Line Input #FileNum, TextFileLineIn '  next line in text file
        Loop
    -..To this
    Code:
        Do While Not EOF(FileNum) = True And Left(TextFileLineIn, 4) = "NSE," '  Left(TextFileLineIn, 4) = "NSE," ' For text file lines like   NSE,101010,6,<,12783,A,,,,,GTT that may have extra unwanted lines like in one Avinash uses stupidly for explanations
         Let RwCnt = RwCnt + 1 ' for first and subsequent lines given by below. ... but
         Line Input #FileNum, TextFileLineIn '  next line in text file
        Loop
        If EOF(FileNum) = True Then Let RwCnt = RwCnt + 1    '                  ... but if the last line I want is EOF, I will not catch it in the loop so must add a 1 here 
    Full macro here:
    https://excelfox.com/forum/showthrea...ll=1#post13619






    Share ‘sample2BEFORE.csv’ : https://app.box.com/s/d8lu7iatfv6h8spp9eru8asm3h4v4e4p
    Share ‘Sample2After.csv’ : https://app.box.com/s/0j4118cwzzofe76ytb5rqkvz3qj0vseu
    vba.xlsm : https://app.box.com/s/juekenyll42z84j6ms7qonzsngnugoyo
    Sample1.xls : https://app.box.com/s/xh58fgjl74w06hvsd53jriqkohdm6a3q
    macro.xlsm : https://app.box.com/s/z358r7tbc9hzthi539dlj49jsf4gyg8p
    1.xls : https://app.box.com/s/38aoip5xi7018y9syt0xe4g04u95l6xk

    Last edited by DocAElstein; 06-09-2020 at 02:03 PM.
    A Folk, A Forum, A Fuhrer ….

  4. #84
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Thnx Alot Doc Sir for Helping me in solving this problem
    & What u suggest, I completely agree with not to play with CSV file & I have decided I will change .CSV to XLSX & then from XLSX to notepad
    & I will upload notepad data to my system not the CSV file

    It is the best way,I think

    What u suggest?

  5. #85
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,458
    Rep Power
    10
    Quote Originally Posted by fixer View Post
    … change .CSV to XLSX & then from XLSX to notepad
    & I will upload notepad data to my system not the CSV file
    I tell you now already 101 times… there are no such things as notepad files , notepad data … etc… you mean text files





    Biggest Problem is not text files

    Excel files sometimes have problem. Excel files sometimes have no problem
    Text files sometimes have problem. Text files sometimes have no problem
    It makes no difference to use only Excel , or only text, or both. Problems remain the same

    Using Excel to manipulate text is mostly no problem if you do it properly, like https://www.homeandlearn.org/open_a_...le_in_vba.html
    To open in Excel or to save a file from Excel to text can give problems often.

    It makes no difference for Avinash to use text files or Excel files
    You do not understand VBA or Excel or text files. This is a problem. It makes no difference if you use text or Excel. This is a problem, but not the biggest problem..

    Biggest problems are
    _ Avinash does not understand English
    _ Avinash replies too quickly, does not read or understand, and makes mistakes
    So we all waste lots of time

    Example
    We wasted a whole day because
    _ Avinash did not understand this:
    ____ Upload the file that gives you the error
    _ Avinash made mistakes and uploaded wrong files
    That was big problem.
    The problem with the macro was very small.





    Quote Originally Posted by fixer View Post
    & What u suggest, I completely agree with not to play with CSV file & I have decided I will change .CSV to XLSX & then from XLSX to notepad
    & I will upload notepad data to my system not the CSV file
    I am not really sure ahat you mean, but
    Biggest problems are from converting/ changing from text ( .csv ) to Excel or Excel to text etc..

    Excel files should stay Excel files
    Text files ( .csv) should stay text files.

    My macros, ( and jindons macros ) have Excel file stay as Excel File, Text file stay as text file.
    No changing or converting Excel to text, text to excel
    This is best.





    ( I do not have anymore time for you today. I look again tomorrow
    )
    A Folk, A Forum, A Fuhrer ….

  6. #86
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Yes plz, but do not look this question
    This is Solved
    Problem Solved

Similar Threads

  1. Replies: 26
    Last Post: 09-26-2020, 05:56 PM
  2. Copy paste data based on criteria
    By analyst in forum Excel Help
    Replies: 7
    Last Post: 01-13-2014, 12:46 PM
  3. Replies: 8
    Last Post: 10-31-2013, 12:38 AM
  4. Replies: 2
    Last Post: 09-18-2013, 12:30 AM

Tags for this Thread

Posting Permissions

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