Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/shanebaby/nicholson.tv/index.php:4) in /home/shanebaby/nicholson.tv/wp-content/themes/Divi/header.php on line 1

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/shanebaby/nicholson.tv/index.php:4) in /home/shanebaby/nicholson.tv/wp-content/themes/Divi/header.php on line 1
Excel Save CSV with double quotes | nicholson.tv

yes, i’m saving this snippet here because it actually works! just insert into the vba for excel, run and remember that it first asks for the source of the file to run the code on, and NOT to output the current file as ‘save as’. get it? good.

Sub CSVFile()

Dim SrcRg As Range
Dim CurrRow As Range
Dim CurrCell As Range
Dim CurrTextStr As String
Dim ListSep As String
Dim FName As Variant
FName = Application.GetSaveAsFilename(“”, “CSV File (*.csv), *.csv”)

If FName <> False Then
ListSep = Application.International(xlListSeparator)
If Selection.Cells.Count > 1 Then
Set SrcRg = Selection
Set SrcRg = ActiveSheet.UsedRange
End If
Open FName For Output As #1
For Each CurrRow In SrcRg.Rows
CurrTextStr = “”
For Each CurrCell In CurrRow.Cells
CurrTextStr = CurrTextStr & “””” & CurrCell.Value & “””” & ListSep
While Right(CurrTextStr, 1) = ListSep
CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) – 1)
Print #1, CurrTextStr
Close #1
End If
End Sub