Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Saving Multiple Tabs as CSV

In Excel2003, I have many sheets that I want to save as individual CSV
files. For example, I have forty sheets in one file that I will end up
with 40 CSV files. I want the files to called by their tab name and
saved @ c:\temp. Any help would on a macro would be appreciated.
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Saving Multiple Tabs as CSV

Hi snax500

See
http://www.rondebruin.nl/copy6.htm

Read the information below the macro about changing the code for csv


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"snax500" wrote in message ...
In Excel2003, I have many sheets that I want to save as individual CSV
files. For example, I have forty sheets in one file that I will end up
with 40 CSV files. I want the files to called by their tab name and
saved @ c:\temp. Any help would on a macro would be appreciated.
Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Saving Multiple Tabs as CSV

Try this (substitute the file name you're working on for YourFileName and the
path you wish to save your csv files to for YourPathName in the code - be
sure to use the quotes as indicated):

Sub SaveSheetsAsFiles()
Dim TabName As String
Dim Sheet As Worksheet
Sheets(1).Activate
On Error Resume Next
For Each Sheet In Sheets
Windows("YourFileName").Activate
TabName = ActiveSheet.Name
MsgBox TabName
ActiveSheet.Next.Activate
Cells.Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:="YourPathName" & TabName & ".csv",
FileFormat:=xlCSV
Next Sheet
End Sub


"snax500" wrote:

In Excel2003, I have many sheets that I want to save as individual CSV
files. For example, I have forty sheets in one file that I will end up
with 40 CSV files. I want the files to called by their tab name and
saved @ c:\temp. Any help would on a macro would be appreciated.
Thanks
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Saving Multiple Tabs as CSV

Forgot about the posting's formatting issues. The code:
[ActiveWorkbook.SaveAs Filename:="YourPathName" & TabName & ".csv",
FileFormat:=xlCSV] needs to be all one line or have the line continuation
characters such as:
ActiveWorkbook.SaveAs Filename:="YourPathName" & TabName & ".csv", _
FileFormat:=xlCSV

"fisch4bill" wrote:

Try this (substitute the file name you're working on for YourFileName and the
path you wish to save your csv files to for YourPathName in the code - be
sure to use the quotes as indicated):

Sub SaveSheetsAsFiles()
Dim TabName As String
Dim Sheet As Worksheet
Sheets(1).Activate
On Error Resume Next
For Each Sheet In Sheets
Windows("YourFileName").Activate
TabName = ActiveSheet.Name
MsgBox TabName
ActiveSheet.Next.Activate
Cells.Copy
Workbooks.Add
ActiveSheet.Paste
ActiveWorkbook.SaveAs Filename:="YourPathName" & TabName & ".csv",
FileFormat:=xlCSV
Next Sheet
End Sub


"snax500" wrote:

In Excel2003, I have many sheets that I want to save as individual CSV
files. For example, I have forty sheets in one file that I will end up
with 40 CSV files. I want the files to called by their tab name and
saved @ c:\temp. Any help would on a macro would be appreciated.
Thanks
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 199
Default Saving Multiple Tabs as CSV

Try this one.

Sub sheets2csv()
Dim vPath As String
Dim Acbk As Workbook
Dim sh As Worksheet

vPath = "C:\temp"
ChDir vPath
Set Acbk = ActiveWorkbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each sh In Worksheets
sh.Copy
ActiveWorkbook.SaveAs filename:=ActiveSheet.Name, FileFormat:=xlCSV
ActiveWorkbook.Close
Acbk.Activate
Next

End Sub

Keiji

snax500 wrote:
In Excel2003, I have many sheets that I want to save as individual CSV
files. For example, I have forty sheets in one file that I will end up
with 40 CSV files. I want the files to called by their tab name and
saved @ c:\temp. Any help would on a macro would be appreciated.
Thanks

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
How do I move multiple tabs in multiple workbooks to a master? teelee Excel Worksheet Functions 3 October 15th 09 05:03 PM
Create multiple sheet tabs from multiple cells. Robert Maddox Excel Worksheet Functions 17 November 14th 07 10:28 PM
Saving to text file - tabs from empty cells ignored lif[_8_] Excel Programming 0 July 20th 06 04:51 PM
macro: copy multiple workbooks to multiple tabs in single book Michael Excel Programming 0 July 14th 06 04:53 PM
Shared folder - tabs disappear while saving gizmo Excel Worksheet Functions 0 February 3rd 05 10:36 AM


All times are GMT +1. The time now is 01:06 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"