Convert csv to Excel files

N

nc

I have around 100 excel worksheets stored in csv format in one single folder.
I have to save each and every single csv worksheet to xls format which is a
very cumbersome job. Pls provide me with some macro which automatically
converts all csv files stored in folder to xls format. Ideally that macro
should first ask me to point to location where all csv files are located and
then it should convert all files to xls format.
 
D

Daniel.C

Try (you may have trouble with pre XL2003 versions) :

Sub test2()
Dim myFolder As String, myFile As String
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
myFolder = .SelectedItems(1)
End With
myFile = Dir(myFolder & "\*.csv")
Do While myFile <> ""
Workbooks.Open myfilder & myFile
ActiveWorkbook.SaveAs myFolder & "\" & Left(myFile, Len(myFile) - 4)
& ".xls", xlNormal
ActiveWorkbook.Close
myFile = Dir
Loop
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

Top