Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Slight problem - routine to add quotes to a column

Thanks Tom

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
Adding double quotes around entries in a column NCdesigner Excel Discussion (Misc queries) 6 December 12th 08 08:34 PM
Problem: Copying a cell that contains line breaks adds extra quotes [email protected] Excel Discussion (Misc queries) 0 November 2nd 06 07:58 PM
excel office V excel viewer, slight problem Scudo New Users to Excel 3 January 18th 06 05:12 PM
Slight Problem Nick Excel Discussion (Misc queries) 1 June 29th 05 04:54 PM
Slight problem automating Excel in a service someone Setting up and Configuration of Excel 2 May 13th 05 10:04 PM


All times are GMT +1. The time now is 08:54 AM.

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"