Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc
external usenet poster
 
Posts: 107
Default Saving as CSV

I have the following macro to sort and date stamp my data and export it as
text. My query is how to export it as csv. Anyone have any suggestions?

Many thanks

TP

Dim campaign As String
campaign = Range("b3")

Range("A1:DB524").Select
Selection.Copy
Sheets("export").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Range("A1:DB524").Select
Cells.Replace What:="0", Replacement:="", LookAt:=xlPart, SearchOrder:=
_
xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
Range("e3") = ""


Dim r As Range, c As Range
Dim sTemp As String

Open "Booking " & campaign & " " & Format(Date, "dd-mm-yy") + "_" +
Format(Time, "hh-mm-ss") & ".txt" For Output As #1




For Each r In Selection.Rows
sTemp = ""
For Each c In r.Cells
sTemp = sTemp & c.Text & Chr(9)
Next c

'Get rid of trailing tabs
While Right(sTemp, 1) = Chr(9)
sTemp = Left(sTemp, Len(sTemp) - 1)
Wend
Print #1, sTemp
Next r
Close #1

Range("A1:DB524").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A1").Select
Sheets("Main").Select
Range("A1").Select



End Sub


 
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
saving as an add-in? Howard Excel Worksheet Functions 1 February 1st 08 12:06 AM
A: saving Curt Excel Discussion (Misc queries) 5 April 11th 07 04:10 AM
Saving DRANDON Excel Discussion (Misc queries) 1 July 28th 06 07:09 PM
Saving Changes blatham Excel Discussion (Misc queries) 4 February 3rd 06 03:17 PM
Web Saving Help drvortex Excel Worksheet Functions 0 November 2nd 04 01:54 AM


All times are GMT +1. The time now is 05:20 PM.

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"