M
missycoo
I have a macro that reads in data from a .txt file. The data contains
user IDs that consist of the first 4 letters of their name and 4
numbers. When names are read in that begin with MARCxxxx (ie
MARC1234), excel is formating them as a date, and I lose the original
data (even when I try to format them after the import, they are a
number and the letters are not there. I've tried to format the column
that they data read into before the import, but excel still imports
them as a date. How can I make the import be read as text?
Here is the code for the section I am reading in data for.
Do While (EOF(Filenum) = False)
Line Input #Filenum, CurrentLine
If CurrentLine = "" Then 'skip line if there is nothing on it
Else
Cells(rownum, 3) = Mid(CurrentLine, 1, 12)
Cells(rownum, 1) = Mid(CurrentLine, 13, 15) ' This line
reads in as date when user is MARCxxxx
Cells(rownum, 2) = Mid(CurrentLine, 28, 34)
user IDs that consist of the first 4 letters of their name and 4
numbers. When names are read in that begin with MARCxxxx (ie
MARC1234), excel is formating them as a date, and I lose the original
data (even when I try to format them after the import, they are a
number and the letters are not there. I've tried to format the column
that they data read into before the import, but excel still imports
them as a date. How can I make the import be read as text?
Here is the code for the section I am reading in data for.
Do While (EOF(Filenum) = False)
Line Input #Filenum, CurrentLine
If CurrentLine = "" Then 'skip line if there is nothing on it
Else
Cells(rownum, 3) = Mid(CurrentLine, 1, 12)
Cells(rownum, 1) = Mid(CurrentLine, 13, 15) ' This line
reads in as date when user is MARCxxxx
Cells(rownum, 2) = Mid(CurrentLine, 28, 34)