write a line from Excel to a text file

  • Thread starter Thread starter julian_bro
  • Start date Start date
J

julian_bro

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.
 
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
 
Back
Top