Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
How do I convert an excel file into a comma separated values file Conquerer Excel Discussion (Misc queries) 3 August 17th 06 09:19 PM
How to substitute a comma with a newline char using Replace. edspyhill01 Excel Discussion (Misc queries) 9 July 30th 06 12:38 AM
How can I save a file as a comma-delimited text file in Excel? LAM Excel Discussion (Misc queries) 1 May 3rd 05 10:24 PM
How many copies of a file can be updated by the "File/Save" comma. Dale New Users to Excel 1 May 2nd 05 02:34 AM
Excel How do I create a comma delineated xls file to a comma delineated. Mark Excel Discussion (Misc queries) 0 November 26th 04 10:28 PM


All times are GMT +1. The time now is 07:38 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"