Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slight problem - routine to add quotes to a column
Hi,
I'm using the following code to enclose all values in a specific column (Excel column 'CC') in a CSV file (obviously when opened in Excel). Sub Test() Dim RangeFirstColumn As Range Dim i As Range Set RangeFirstColumn = Range("CC2", Range("CC" & Rows.Count).End(xlUp).Address) For Each i In RangeFirstColumn If Len(i.Value) 0 Then i = Chr(34) & i.Value & Chr(34) Next i End Sub The problem is, when I open up the resulting .csv in Notepad, the field in question in each row is now enclosed in three quotation marks instead of the expected one (e.g. """010""" rather than "010"). Could anyone advise me of what changes I need to make to my code? Many thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slight problem - routine to add quotes to a column
Since you place quotes in the text in the cell, excel puts in more quotes so
your quotes are retained. http://support.microsoft.com/default...b;en-us;291296 Procedure to export a text file with both comma and quote delimiters in Excel -- Regards, Tom Ogilvy wrote in message oups.com... Hi, I'm using the following code to enclose all values in a specific column (Excel column 'CC') in a CSV file (obviously when opened in Excel). Sub Test() Dim RangeFirstColumn As Range Dim i As Range Set RangeFirstColumn = Range("CC2", Range("CC" & Rows.Count).End(xlUp).Address) For Each i In RangeFirstColumn If Len(i.Value) 0 Then i = Chr(34) & i.Value & Chr(34) Next i End Sub The problem is, when I open up the resulting .csv in Notepad, the field in question in each row is now enclosed in three quotation marks instead of the expected one (e.g. """010""" rather than "010"). Could anyone advise me of what changes I need to make to my code? Many thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slight problem - routine to add quotes to a column
Thanks Tom
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding double quotes around entries in a column | Excel Discussion (Misc queries) | |||
Problem: Copying a cell that contains line breaks adds extra quotes | Excel Discussion (Misc queries) | |||
excel office V excel viewer, slight problem | New Users to Excel | |||
Slight Problem | Excel Discussion (Misc queries) | |||
Slight problem automating Excel in a service | Setting up and Configuration of Excel |