Last active
July 22, 2017 14:54
-
-
Save sabrina-zeidan/a493760c8ca68947c3d3174dd04a8b66 to your computer and use it in GitHub Desktop.
This macros will bulk covert csv to xlsx in Excel. First, save csv to txt (just changing name.csv to name.txt in totalcommaner or similar, bulk in one click). Place to CSVfolder = "C:\csv\txt\" ,output will be here XlsFolder = "C:\csv\xlsx\"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Sub CommandButton2_Click() | |
Dim CSVfolder As String, _ | |
XlsFolder As String, _ | |
fname As String, _ | |
wBook As Workbook | |
CSVfolder = "C:\csv\txt\" | |
XlsFolder = "C:\csv\xlsx\" | |
fname = Dir(CSVfolder & "*.txt") | |
Do While fname <> "" | |
Set wBook = Workbooks.Open(CSVfolder & fname, Format:=4) | |
wBook.SaveAs XlsFolder & Replace(fname, ".txt", ""), xlOpenXMLWorkbook | |
wBook.Close False | |
fname = Dir | |
Loop | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment