View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nikos Yannacopoulos[_4_] Nikos Yannacopoulos[_4_] is offline
external usenet poster
 
Posts: 5
Default Generate .txt file from 2 cols of data

Here's the code you need:

Sub Export_Text_Files()
Dim lin As String
Range("C6").Select

For i = 1 To 16
Open "c:\temp\File" & i & ".txt" For Output As #1
For j = 0 To 143
lin = ActiveCell.Offset(j, 0).Value & ";"
lin = lin & ActiveCell.Offset(j, i).Value & ";"
Print #1, lin
Next
Close #1
Next

End Sub


You can easily change the path and produced file name, as
well as the field separator.

Nikos Y. (nyannaco at in dot gr)
-----Original Message-----

What do I need to do to generate a text file from 2

(sometimes not
adjacent) columns of data. Say I have a matrix of date

C6:S149.
Column C contains the x data (Time) and columns D thru S

contain 16
unique data sets corresponding to the C time column. I

want to create
separate .txt files of the combination C & D, C & E, C &

F, ..., C & S.
A text file with 2 columns of data, C (Time) and one of D

thru F
(data). Thanks.


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

http://www.ExcelForum.com/

.