Saberexcel - o site das macros
Esta macro do aplicativo Microsoft Excel VBA, abre um arquivo CSV
'CSV ( Microsoft Excel Comma Separated Values Files )
Sub Abre_arquivo_Csv_xls()
Sheets("Plan1").Activate
Dim x, y, vLinhaAnterior, vColunaAnterior
Application.ScreenUpdating = False
ActiveSheet.Range("A1").Select
Selection.CurrentRegion.Select
Set tbl = ActiveCell.CurrentRegion
vLinhaAnterior = tbl.Rows.Count
vColunaAnterior = tbl.Columns.Count
Cells(1, 1).Select
Open "Pagamento" + b5 + ".csv" For Output As #1
For x = 1 To vLinhaAnterior
For y = 1 To vColunaAnterior - 1
If TypeName(Cells(x, y + 1).Value) = "Date" Then
Print #1, Format(Cells(x, y + 1).Formula, "dd/mm/yyyy hh:mm:ss") & ";";
Else
Print #1, Cells(x, y + 1).Formula & ";";
End If
Print #1, Cells(x, y).Formula + ";";
Next y
Print #1, Cells(x, y + 1)
Next x
Close #1
End Sub
Aprenda tudo sobre o Aplicativo Microsoft Excel VBA, sozinho, praticando com os produtos didáticos Saberexcel