save each sheet as .csv

  • Thread starter Thread starter jsmonje
  • Start date Start date
J

jsmonje

my file.xls has multiple worksheets. i am looking for a macro that will
save each sheet as a unique .csv using the name of the worksheet.
thanks in advance
 
Hi JS,

Try:

'=============>>
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet

Set WB = ActiveWorkbook '<<=== CHANGE

On Error GoTo XIT
Application.DisplayAlerts = False
For Each SH In ActiveWorkbook.Worksheets
SH.Copy
With ActiveWorkbook
.SaveAs Filename:=ActiveSheet.Name, _
FileFormat:=xlCSV
.Close False
End With
Next SH

XIT:
Application.DisplayAlerts = True
End Sub
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top