+ Reply to Thread
Results 1 to 5 of 5

Read a file from bottom to top

  1. #1
    Registered User
    Join Date
    05-08-2020
    Location
    Pennsylvania, USA
    MS-Off Ver
    2016
    Posts
    35

    Read a file from bottom to top

    I have the code listed below that reads a file line by line, searches for key properties, and then writes the results to the worksheet. This works fine as is, but I now need to read the file from the bottom to the top. I have not been able to find a way to do that using the "Line In" function. Can this be done with a minor adjustment?

    Thanks for the help.


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    08-24-2022
    Location
    hugo
    MS-Off Ver
    13
    Posts
    40

    Re: Read a file from bottom to top

    Without a sample file its hard to know if this will work.
    Try this code:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-08-2020
    Location
    Pennsylvania, USA
    MS-Off Ver
    2016
    Posts
    35

    Re: Read a file from bottom to top

    Thanks. I tried the code and got this error Attachment 821198.

    The files I am trying to read are given to me as *.CNV files, which look like Excel in text formats. I could not get the file to upload, but here are a few lines that might help.

    # <!-- SPAR voltage, SPAR/Surface Irradiance -->
    # <SPAR_Sensor SensorID="51" >
    # <SerialNumber>20271</SerialNumber>
    # <CalibrationDate>28-Feb-12</CalibrationDate>
    # <ConversionFactor>1536.86200000</ConversionFactor>
    # <RatioMultiplier>10000.00000000</RatioMultiplier>
    # </SPAR_Sensor>
    # </sensor>
    # </Sensors>
    # datcnv_date = Aug 24 2012 01:26:42, 7.21f [datcnv_vars = 16]
    # datcnv_in = C:\Data\2012 Data\Summer Survey 2012\Erie\ER31.hex C:\Data\2012 Data\Summer Survey 2012\Erie\ER31.XMLCON
    # datcnv_skipover = 0
    # datcnv_ox_hysteresis_correction = yes
    # datcnv_ox_tau_correction = yes
    # file_type = ascii
    *END*
    0.529 21.0898 0.000382 4.68817 3.9846e+03 8.042 98.58 0.4039 90.3964 0.752 23.80 2.6862e-02 0.415 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.505 21.0902 0.001313 4.68812 3.9846e+03 8.042 98.58 0.4039 90.3964 0.719 23.80 2.8083e-02 1.425 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.474 21.0903 0.002935 4.67665 3.9846e+03 8.037 98.58 0.4039 90.3964 0.675 23.80 1.9536e-02 3.184 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.529 21.0907 0.002274 4.68746 3.9846e+03 8.028 98.58 0.4039 90.3964 0.752 23.80 4.8840e-03 2.467 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.474 21.0909 0.000292 4.67601 3.9846e+03 8.028 98.58 0.4039 90.3964 0.675 23.80 0.0000e+00 0.317 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.505 21.0912 0.001343 4.67541 3.9846e+03 8.023 98.58 0.4039 90.3964 0.719 23.80 0.0000e+00 1.457 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.474 21.0914 0.001163 4.67481 3.9846e+03 8.018 98.58 0.4039 90.3964 0.675 23.80 0.0000e+00 1.262 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.529 21.0917 0.000502 4.67427 3.9846e+03 8.013 98.58 0.4039 90.3964 0.752 23.80 0.0000e+00 0.545 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.451 21.0919 0.000683 4.67370 3.9846e+03 8.013 98.58 0.4039 90.3964 0.641 23.80 0.0000e+00 0.740 2.0585e+03 1.7069597 22.213675 0.000e+00
    0.529 21.0921 0.000803 4.67324 3.9846e+03 8.013 98.61 0.4039 90.3964 0.752 23.79 0.0000e+00 0.871 2.0585e+03 1.7069597 22.213675 0.000e+00

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,534

    Re: Read a file from bottom to top

    Below is a scheme for reading the file backwards.

    The result in the Immediate window.
    Please Login or Register  to view this content.
    Artik

  5. #5
    Registered User
    Join Date
    05-08-2020
    Location
    Pennsylvania, USA
    MS-Off Ver
    2016
    Posts
    35

    Re: Read a file from bottom to top

    Thanks. This is perfect. Just flip the order before processing!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Want to keep the Read Only message from appearing when read only file is opened
    By ILoveStMartin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2019, 09:33 AM
  2. [SOLVED] Checking to see if a file has been opened in Read/Write or Read Only
    By brokenbiscuits in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-13-2014, 09:16 AM
  3. Read-only file on server. How many people can read at once?
    By Xx7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 12:10 AM
  4. Replies: 5
    Last Post: 06-26-2012, 02:00 PM
  5. Using ADO to read closed file does not read formulas
    By treyr in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-09-2010, 12:26 PM
  6. [SOLVED] I have a read only xl file, I need it to be read and write
    By drama queen in forum Excel General
    Replies: 3
    Last Post: 06-30-2006, 07:30 PM
  7. How can a file be converted from Read-Only to Read/Write
    By Jim in Apopka in forum Excel General
    Replies: 2
    Last Post: 11-19-2005, 01:00 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1