ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do i Save a file with the name i want and with CVS(Command Del (https://www.excelbanter.com/excel-programming/434149-how-do-i-save-file-name-i-want-cvs-command-del.html)

Noe[_2_]

how do i Save a file with the name i want and with CVS(Command Del
 
I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv


Matthew Herbert[_3_]

how do i Save a file with the name i want and with CVS(Command Del
 
Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv


Noe

how do i Save a file with the name i want and with CVS(Command
 
Matthew Herbert,

These is great thank you so much for you time, I just have an aditional
question in the same macro can select from Colum A thru E and cut and past
and the new book and save.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv


Noe

how do i Save a file with the name i want and with CVS(Command
 
Matthew this is great, thank you so much.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv


Matthew Herbert[_3_]

how do i Save a file with the name i want and with CVS(Command
 
Noe,

Replace
Wks.Copy .Worksheets(1)
with
Wks.Columns("A:F").Copy .Worksheets(1).Range("A1")
in order to copy columns "A:F" from the worksheet into the new workbook.

Best,

Matt

"Noe" wrote:

Matthew Herbert,

These is great thank you so much for you time, I just have an aditional
question in the same macro can select from Colum A thru E and cut and past
and the new book and save.

"Matthew Herbert" wrote:

Noe,

This does not check if the file exists in the specified location and assigns
a counter number as the file name. Anyhow, one way is below, so modify the
code as needed. I'm sure others will post code that will do what you want.

Best,

Matthew Herbert

Sub SaveWksAsCSV()
Dim Wks As Worksheet
Dim Wkb As Workbook
Dim strFPath As String
Dim intCnt As Integer

Application.ScreenUpdating = False
strFPath = "C:\Documents and Settings"

For Each Wks In ActiveWorkbook.Worksheets
Set Wkb = Workbooks.Add
With Wkb
Wks.Copy .Worksheets(1)
.Worksheets(1).Name = intCnt
.SaveAs strFPath & "\" & intCnt & ".csv", xlCSV
.Close False
End With
intCnt = intCnt + 1
Next Wks
End Sub


"Noe" wrote:

I have four individual sheets and every individual sheet i need to copy to
another sheet and save as CVS Command Delimit and put a name
IGP_JUNE_CONV_2009_13.csv



All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com