Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enclosing values in Quotation marks

I am currently using the script below to copy values from one sheet t
another.

I am hoping to get all values copied to the destination sheet enclose
by quotation marks (eg "value1"), so that I can then save the sheet a
a .CSV file for a dataload.

Can anyone please suggest a modification to the sub below that would d
this?

Sub CSV()
Dim DestSheet As Worksheet, SrcSheet As Worksheet
Set SrcSheet = ActiveSheet
Set DestSheet = Sheet2
With SrcSheet
.Activate
Range(.Range("a3"), .Range("a3").End(xlDown)).Resize(,
34).Copy
End With
With DestSheet.Range("a1")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
End Sub


xl2000 on windows 2

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 132
Default Enclosing values in Quotation marks

Dear ByPass;

If I understand you correctly you just need to save sheet
2 out as a csv file. Excel will handle the delimiting for
you automatically. The code might look like the below.
You will probably want to disable the alerts.

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Administrator\My
Documents\Book1.csv", FileFormat _
:=xlCSV, CreateBackup:=False


Thanks,

Greg

-----Original Message-----
I am currently using the script below to copy values from

one sheet to
another.

I am hoping to get all values copied to the destination

sheet enclosed
by quotation marks (eg "value1"), so that I can then save

the sheet as
a .CSV file for a dataload.

Can anyone please suggest a modification to the sub below

that would do
this?

Sub CSV()
Dim DestSheet As Worksheet, SrcSheet As Worksheet
Set SrcSheet = ActiveSheet
Set DestSheet = Sheet2
With SrcSheet
.Activate
Range(.Range("a3"), .Range("a3").End(xlDown)).Resize(,
34).Copy
End With
With DestSheet.Range("a1")
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
End Sub


xl2000 on windows 2K


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Enclosing values in Quotation marks

Don't think that approach will give you what you want - you will end up with
more double quotes than you bargained for if you were successful (plus there
is no command to do that anyway - not sure why you think pastespecial will
put in doublequotes).

See this article for code that should produce the csv file you describe.

http://support.microsoft.com/default...48&Product=xlw
XL2000: Procedure to Export a Text File with Both Comma and Quote Delimiters

--
Regards,
Tom Ogilvy


"bypass " wrote in message
...
I am currently using the script below to copy values from one sheet to
another.

I am hoping to get all values copied to the destination sheet enclosed
by quotation marks (eg "value1"), so that I can then save the sheet as
a .CSV file for a dataload.

Can anyone please suggest a modification to the sub below that would do
this?

Sub CSV()
Dim DestSheet As Worksheet, SrcSheet As Worksheet
Set SrcSheet = ActiveSheet
Set DestSheet = Sheet2
With SrcSheet
Activate
Range(.Range("a3"), .Range("a3").End(xlDown)).Resize(,
34).Copy
End With
With DestSheet.Range("a1")
PasteSpecial xlPasteValues
PasteSpecial xlPasteFormats
End With
End Sub


xl2000 on windows 2K


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Enclosing values in Quotation marks

Thanks Tom

That was exactly what I was looking fo

--
Message posted from http://www.ExcelForum.com

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
Quotation Marks 9pluck9 Excel Discussion (Misc queries) 2 May 2nd 07 04:40 PM
Quotation Marks? LinearChaos Excel Worksheet Functions 2 June 25th 06 10:31 PM
without quotation marks? jfazz Excel Discussion (Misc queries) 1 March 2nd 06 04:43 PM
Quotation Marks - When and What?? heski Excel Discussion (Misc queries) 2 February 7th 06 12:40 PM
quotation marks JohnF Excel Worksheet Functions 7 February 5th 06 09:33 PM


All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"