PDA

View Full Version : [SOLVED] Read Each Row Output Text File



sheeeng
06-23-2005, 02:58 AM
Hi all,

How can I read value row by row in Sheet1?
And output all into a txt file?

Thanks. :hi:

Bob Phillips
06-23-2005, 03:04 AM
How can I read value row by row in Sheet1?
And output all into a txt file?

oooh, tricky:devil:

Actually, it is surprisingly simple



Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\myTest\Sheeeng.txt", _
FileFormat:=xlText, _
CreateBackup:=False
Application.DisplayAlerts = True

sheeeng
06-23-2005, 03:23 AM
Sorry, xld. Not really what I need.
Maybe I should clarify a bit.

eg.
the macro reads through the each row, output in msgbox the value in the cell, output file, and read the next cell, and so on.......

Most important is that it can read row by row and display the row datas....

Bob Phillips
06-23-2005, 03:31 AM
Sorry, xld. Not really what I need.
Maybe I should clarify a bit.

eg.
the macro reads through the each row, output in msgbox the value in the cell, output file, and read the next cell, and so on.......

Most important is that it can read row by row and display the row datas....

Just precede it by a loop to output all


Dim iLastRow As Long
Dim i As Long


iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
Msgbox Cells(i,"A").Value
Next i

sheeeng
06-23-2005, 05:06 AM
What does the code below does?


Cells(Rows.Count,"A").End(xlUp).Row

Bob Phillips
06-23-2005, 07:05 AM
What does the code below does?


Cells(Rows.Count,"A").End(xlUp).Row


Finds the last non-empty row in column A.

sheeeng
06-24-2005, 12:41 AM
Good. Another solved by alll your help.
Thanks a lot!!