LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Export multiple sheets to 1 csv file.

Does anyone have a function I could use to export multiple worksheets (each
contains around 65000 lines) into 1 CSV file?
I have the following script which does a unique file for each worksheet, but
I'm lousy with VB programming and hopeing someone out there already has a
function or can help me edit this one.
And ideally I want to miss out the first 2 sheets from the export.

Thanks.
-----------------------------
Option Explicit
Sub mysaver()
Dim counter As Integer
counter = 1
' counter is for the number of sheets in the workbook
Do While counter <= Worksheets.Count
' Worksheets.Count represents the total number of sheets in the workbook
On Error GoTo ErrorHandler
' go to the nominated sheet
Worksheets(counter).Activate
' and save it. Simple...
ActiveSheet.SaveAs Filename:=ActiveSheet.Name, FileFormat:=xlCSV
counter = counter + 1
Loop
MsgBox "All Sheets Saved.", , "Success"
Exit Sub

ErrorHandler:
MsgBox "Error during save - Caution!", vbCritical, "Save Errors"
Exit Sub
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
export sheets to multiple new files Tanya Excel Discussion (Misc queries) 8 April 20th 09 10:00 PM
export multiple sheets to multiple excel files Tanya Excel Discussion (Misc queries) 1 April 20th 09 08:57 PM
ExportAsFixedFormat for Multiple Sheets in a Single Excel File ivanL Excel Worksheet Functions 2 February 12th 08 07:42 PM
export re-order input fields to export file [csv] madisonpete Excel Worksheet Functions 0 November 30th 07 03:51 PM
Lookup on multiple sheets in file Steph[_3_] Excel Programming 2 December 23rd 04 04:02 AM


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