Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Generate .txt file from 2 cols of data


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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate reports on separate tabs from data in file [email protected] Excel Discussion (Misc queries) 3 May 6th 09 01:30 AM
Generate reports on separate tabs from data in file [email protected] Excel Worksheet Functions 3 May 6th 09 01:30 AM
2 Cols To 2 Cols VLookup Comparison CuriousMe Excel Discussion (Misc queries) 4 December 21st 06 07:54 PM
generate a random number and use if function to generate new data Dogdoc1142 Excel Worksheet Functions 4 April 26th 06 03:44 AM
Cond Format:re color 2 cols, skip 2 cols Tat Excel Worksheet Functions 2 June 22nd 05 06:43 PM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"