text file with tab

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to export some data (with tab delimiter) from excel, with
HEADER which is string, to .txt file. In exported .txt file, I get quotation
(" ") for string which I don't want. I have written:

Open "test.txt" for output as #1
print #1, "Time", tab, "Average"

for i = 1 to lastrow
Print #1, sheets("test").Cells(i,1), tab, sheets("test").Cells(i,3)
next i

I want the text file as:
Time (Tab) Average
1/1/1999 (Tab) 3.5
1/2/1999 (Tab) 5.5

Could you please help me out?

Thanks,
Nazrul
 
Try
Open "H:\test.txt" For Output As #1
Print #1, "Time", vbTab, "Average"
For i = 1 To lastrow
Print #1, Sheets("sheet1").Cells(i, 1), vbTab,
Sheets("sheet1").Cells(i, 3)
Next i
Close #1


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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

Back
Top