ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   write a line from Excel to a text file (https://www.excelbanter.com/excel-programming/278282-write-line-excel-text-file.html)

julian_bro

write a line from Excel to a text file
 
Having tested for the correct 'key word' , when found i want to write
out the whole row to a new file.

While Worksheets(1).Cells(irowcount, 1) < ""
If InStr(1, Worksheets(1).Cells(irowcount, 1), "STATION",
vbTextCompare) 0 Then
ts.writeline Worksheets(1).irowcount
End If

This line doesn't work

ts.writeline Worksheets(1).irowcount
nor does
ts.writeline Worksheets(1).cells(irowcount,1:40)

can any one help

Julian brotheton.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Paul D[_2_]

write a line from Excel to a text file
 
writeline needs a string
how about
ts.writeline Worksheets(1).cells(irowcount,1).value
if you are trying to write the values from columns 1 to 40 use a for loop
for i = 1 to 40
ts.writeline Worksheets(1).cells(irowcount,i).value
next i
of course this creates 40 lines of text. You may want to look at the write
# if you are looking for delimited data

Paul D


"julian_bro" wrote in message
...
Having tested for the correct 'key word' , when found i want to write
out the whole row to a new file.

While Worksheets(1).Cells(irowcount, 1) < ""
If InStr(1, Worksheets(1).Cells(irowcount, 1), "STATION",
vbTextCompare) 0 Then
ts.writeline Worksheets(1).irowcount
End If

This line doesn't work

ts.writeline Worksheets(1).irowcount
nor does
ts.writeline Worksheets(1).cells(irowcount,1:40)

can any one help

Julian brotheton.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com