Categories
excel office

Makro Excel Ubah beberapa worksheet ke fail CSV berasingan

[code lang=’vb’]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[/code]

  1. Pada fail excel tekan Alt dan F11 serentak
  2. Pilih Insert -> Module
  3. Pindah kod diatas
  4. Tekan Alt dan Q untuk kembali ke fail excel
  5. Tekan Alt dan F8 dan klik Run

Sumber: http://www.accountingweb.co.uk/anyanswers/macro-exporting-50-worksheets-csv-one-pass

Leave a Reply

Your email address will not be published. Required fields are marked *