Share this content

Macro for exporting 50 worksheets to CSV in one pass

Macro for exporting 50 worksheets to CSV in one...

Didn't find your answer?

Anyone know an easy way to export 50 excel sheets (in one workbook) to csv format, in one pass, without resorting to VB?

Paul Garrity

Replies (2)

Please login or register to join the discussion.

By Accounting WEB
31st Jan 2001 23:47

No real option - VB is the way to go. Try this for size...
"All care, no responsibility"

Cut and paste into VBA (Tools, Macro, VB Editor). Click ThisWorkbook in the project window, then paste in the following:

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
' and save it. Simple...
ActiveSheet.SaveAs FileName:=ActiveSheet.Name, FileFormat:=xlCSV
counter = counter + 1
MsgBox "All Sheets Saved.", , "Success"
Exit Sub

MsgBox "Error during save - Caution!", vbCritical, "Save Errors"
Exit Sub
End Sub

Now try running this macro. Hope this helps.

Thanks (0)
By AnonymousUser
01st Feb 2001 10:09

Works perfectly.

Thanks (0)
Share this content