read text file

H

hallie

my text file is of fixed width format..I have 2 problems
that I've tried to troubleshoot..

1) An error is highlighted at Line 5 (RunTime error 1004
Application-defined or object-defined error)

2)The data was correctly diplayed in cells BUT there are
blanks rows between the cells with correct data( the nos
of blank row varies)


par of the code:
Do While Not EOF(1)
Line Input #1, data
Worksheets("Sheet1").Activate

Line5: Cells(i, 1).Value = Mid(data, 1, 8)
i=i+1
Loop


some kind member pls advise ...thanks
 
T

Tom Ogilvy

I can't say why you get blank lines - are you sure you txt file doesn't have
blank lines in it.

As far as the error, I suspect you haven't initialized the value of i to a
legitimate row number before you loop starts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top