Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Generate reports on separate tabs from data in file | Excel Discussion (Misc queries) | |||
Generate reports on separate tabs from data in file | Excel Worksheet Functions | |||
2 Cols To 2 Cols VLookup Comparison | Excel Discussion (Misc queries) | |||
generate a random number and use if function to generate new data | Excel Worksheet Functions | |||
Cond Format:re color 2 cols, skip 2 cols | Excel Worksheet Functions |