开发者

XLS with 512 sheets to 512 CSVs

I have an XLS file containing 512 sheets, I want to have each sheet in separate CSV file, and I'm not going to do this by hand.

Any i开发者_运维知识库dea?


Sub SeparateCSV()

    Dim sh As Worksheet
    Dim wb As Workbook

    For Each sh In ThisWorkbook.Worksheets
        sh.Copy
        Set wb = ActiveWorkbook
        wb.SaveAs sh.Name & ".csv", xlCSV
        wb.Close False
    Next sh

End Sub


Sub Macro1()
Dim ws As Worksheet

For Each ws In Worksheets
    ws.SaveAs Filename:= "C:\" & ws.Name, FileFormat:=xlCSV, CreateBackup:=False
Next ws

End Sub


Save one sheet manually while recording it with the macro recorder, then wrap (and edit) the VBA code in a loop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜