Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Substitute comma in csv file
Another way is to create a string that contatenates all
the necessary data and puts comma's (using string concatenation). I just put the new, concatenated string in a new cell (maybe on a new tab) for data output. Concatenate the comma to the existing string data as: =B2&","&C2&"," etc., ugly but it works -----Original Message----- One way: Public Sub MySV() Const DELIMITER As String = "^" Dim cell As Range Dim myRow As Range Dim sOut As String Open "Test.txt" For Output As #1 For Each myRow In Range("A1:A" & _ Range("A" & Rows.Count).End(xlUp).Row) With myRow For Each cell In Range(.Cells, _ Cells(.Row, Columns.Count).End (xlToLeft)) sOut = sOut & DELIMITER & cell.Text Next cell Print #1, Mid(sOut, 2) sOut = Empty End With Next myRow Close #1 End Sub substitute your favorite character in DELIMITER as desired... Note: This routine assumes you have data in column A of your last row. In article , "ajs" wrote: I want to produce a .txt or .csv file from Excel that separates each cell with a character of MY choice. I can successfully create tab and comma delimited files, but not one using a single delimiter of my choice. Any ideas gratefully received. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I convert an excel file into a comma separated values file | Excel Discussion (Misc queries) | |||
How to substitute a comma with a newline char using Replace. | Excel Discussion (Misc queries) | |||
How can I save a file as a comma-delimited text file in Excel? | Excel Discussion (Misc queries) | |||
How many copies of a file can be updated by the "File/Save" comma. | New Users to Excel | |||
Excel How do I create a comma delineated xls file to a comma delineated. | Excel Discussion (Misc queries) |