write data from excel file to text file

C

Curt

Have the following it creates a text file with the headings but none of the
data in rows. Row 1 is the headings following rows are data there are 5
columns in worksheet. Have allowed for up to 50 rows which will probably not
all be used.
Columns have varying formats. This sheet is created by another used for data
entry.
I missed something as it writes headings from row 1 but no more. DUH
Thanks

Sub writer()
Dim rcount, ccount
Open "c:\parade\4wk.txt" For Output As #1
Sheets("maile").Select
With Selection
For rcount = 1 To Range("w3").Value + 1
Write #1, Cells(rcount, 1), Cells(rcount, 2), Cells(rcount, 3), _
Cells(rcount, 4), Cells(rcount, 5), Cells(rcount, 6), Cells(rcount, 7), _
Cells(rcount, 8), Cells(rcount, 9), Cells(rcount, 10), Cells(rcount, 11), _
Cells(rcount, 12), Cells(rcount, 13), Cells(rcount, 14), Cells(rcount, 15), _
Cells(rcount, 16), Cells(rcount, 17), Cells(rcount, 18), Cells(rcount, 20), _
Cells(rcount, 21), Cells(rcount, 22), Cells(rcount, 23), Cells(rcount, 25), _
Cells(rcount, 26), Cells(rcount, 27), Cells(rcount, 28), Cells(rcount, 29), _
Cells(rcount, 30), Cells(rcount, 31), Cells(rcount, 32), Cells(rcount, 33), _
Cells(rcount, 34), Cells(rcount, 35), Cells(rcount, 36), Cells(rcount, 37), _
Cells(rcount, 38), Cells(rcount, 39), Cells(rcount, 40), Cells(rcount, 41), _
Cells(rcount, 42), Cells(rcount, 43), Cells(rcount, 44), Cells(rcount, 45), _
Cells(rcount, 46), Cells(rcount, 47), Cells(rcount, 48), Cells(rcount, 49), _
Cells(rcount, 50)

Next
Close #1
End With
End Sub
 
D

Doug Robbins - Word MVP

I suggest that you post this question to microsoft.public.excel.programming.
This newsgroup is for the use of Visual Basic with Word.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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