Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello I am new in excel 2007,
how i can export a column of one excel file into text objects separated by comma? For example if i have: column1 = a b c d e f how i can obtain a text like this? data = a,b,c,d,e,f Thanks, you can contact me also by email. Dino. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub WriteColumn()
Const Folder = "C:\temp\test" Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Set fswrite = CreateObject("Scripting.FileSystemObject") WriteCol = "A" 'open files ChDir (Folder) FName = Application.GetSaveAsFilename( _ fileFilter:="Text Files (*.txt), *.txt") If FName < False Then fswrite.CreateTextFile FName Set fwrite = fswrite.GetFile(FName) Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault) LastRow = Range(WriteCol & Rows.Count).End(xlUp).Row OutputLine = "" For RowCount = 1 To LastRow If OutputLine = "" Then OutputLine = Range(WriteCol & RowCount) Else OutputLine = OutputLine & "," & Range(WriteCol & RowCount) End If Next RowCount tswrite.Close End If End Su " wrote: Hello I am new in excel 2007, how i can export a column of one excel file into text objects separated by comma? For example if i have: column1 = a b c d e f how i can obtain a text like this? data = a,b,c,d,e,f Thanks, you can contact me also by email. Dino. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dino
Use text to columns, with fixed width, separate each character. Then save as a csv file. When you open it in a text editor it may have some trailing commas if all the strings in your column do not have the same number of characters. In the text editor you should be able to replace ,, wtih nothing. Good luck. Ken Norfolk, Va On Apr 18, 3:45*am, wrote: Hello I am new in excel 2007, how i can export a column of one excel file into text objects separated by comma? For example if i have: column1 = a *b *c *d *e *f how i can obtain a text like this? data = a,b,c,d,e,f Thanks, you can contact me also by email. Dino. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please re-read the request. Your answer isn't consistant with the request.
"Ken" wrote: Dino Use text to columns, with fixed width, separate each character. Then save as a csv file. When you open it in a text editor it may have some trailing commas if all the strings in your column do not have the same number of characters. In the text editor you should be able to replace ,, wtih nothing. Good luck. Ken Norfolk, Va On Apr 18, 3:45 am, wrote: Hello I am new in excel 2007, how i can export a column of one excel file into text objects separated by comma? For example if i have: column1 = a b c d e f how i can obtain a text like this? data = a,b,c,d,e,f Thanks, you can contact me also by email. Dino. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
You can do Edit, Find, Replace on the column to find " " (put a space bar in the Find box) and replace with "," (put a , in the Replace box). regards Paul On Apr 18, 8:45*am, wrote: Hello I am new in excel 2007, how i can export a column of one excel file into text objects separated by comma? For example if i have: column1 = a *b *c *d *e *f how i can obtain a text like this? data = a,b,c,d,e,f Thanks, you can contact me also by email. Dino. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How did you dimension the variables.
What I used didn't work: Dim fswrite As Object Dim WriteCol As String Dim Fname As Boolean Dim fwrite As Object Dim tswrite As Object Dim lastrow As String Dim outputline As String Dim rowcount As Long |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
text string separated by comma | Excel Discussion (Misc queries) | |||
How do I convert a column of numbers into comma separated values . | Excel Worksheet Functions | |||
Turning column contents into text list separated by a comma | Excel Discussion (Misc queries) | |||
How do I export data from Excel as a series of comma-separated val | New Users to Excel | |||
Going from column to comma separated list... | Excel Discussion (Misc queries) |