Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The only problem that I see here is that my data doesnt fill sheet1 range
(a1:aXX). My data is in specific cells on multiple pages but I think this is enough information to allow me to get what I need done. Ill update whether or not this works soon. Thanks! "Joel" wrote: then re-arrange your loop Open strFile For Input As #2 for i = 1 to 500 '<=change to you r actual last row if eof(2) then Sheets("example").Range("a" & i) = "" else Input #2, a1 Sheets("example").Range("a" & i) = a1 end if next i "Japazo88" wrote: Well, what happens is the program uses a userform to create a .txt savefile and writes all the user inputs line by line. Open strFile For Output As #2 Write #2, Sheets("example").Range("a1") Write #2, Sheets("example").Range("a2") Write #2, Sheets("example").Range("a3") etc... then, when I want to open one of the old savefiles it begins the same process in reverse, Open strFile For Input As #2 Input #2, a1 Sheets("example").Range("a1") = a1 Input #2, a1 Sheets("example").Range("a2") = a1 Input #2, a1 Sheets("example").Range("a3") = a1 etc... The problem arises when the Macro hits the EOF of the savefile. It has a line that says Input #2, a1 Sheets("example").Range("a500") = a1 when a500 was never saved in the old program's output file. So what I want to do in order to do away with one macro for opening old files and one macro for opening new ones is to basically say, if eof then input #2 = "" so that it can read until the end of the file then input blanks after that. Does that make more sense? "Joel" wrote: Why don't you clear the cells before reading in the text file. The program should only read in the data from the text files and the other cells will remain blank. "Japazo88" wrote: Hello everyone, Lets say I have two programs written in excel that are used to automatically select the right car for a person based on height, weight, etc. Both programs do the same thing but the newer version has more inputs and outputs (saved to a .txt) than the old one. My problem is that when trying to read the data from the old saved files I get an "Input Past End of File" error. Basically what I want to do is have the program read all the available data from the text file then fill in the rest of the program input cells as blank. The addition of more inputs wasnt taken into account when the old program was written otherwise empty cells would have been written to allow for the new inputs. What is my best option for filling in blanks once Ive reached the end of the .txt file? Thanks in advance! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
"Unable to Read File" error message in Excel - solutions? | Excel Discussion (Misc queries) | |||
"Cannot access read-only document" (I get this error when I try to open an Excel file) | Excel Discussion (Misc queries) | |||
"Cannot access read-only document" (I get this error when I try to open an Excel file) | Setting up and Configuration of Excel | |||
XCEL FILE REC'D AS READ ONLY -- HOW TO NOT BE "READ ONLY" | Excel Discussion (Misc queries) | |||
Excel 2002/2003 can not open xls file says "may be read only" | Excel Discussion (Misc queries) |