Convert ASCII file to an excel spreadsheet

Abdoula

New Member
Joined
Aug 28, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone.
I need your help , i wanna know if there another method or software that i can use to convert ASC file to Excel? because i have a lot of ASC file and i can't use excel to convert one by one. Thank you for reading me.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello,
I'm not familiar with ASC files, but I think they're similar to text files. If you can open a .ASC with excel and save it as a .xlsx then the code below may work for you.

Copy the code into a new workbook and save the workbook into the same folder as your project files. I strongly suggest you test this on a sample folder with a few sample files. When you run the code, excel will open each .ASC file, save it as a new workbook with the .xlsx extension, then close the file.

VBA Code:
Sub LoopThroughFiles()
'''''   Place this macro workbook in the same folder as your project files
Dim wb As Workbook
Dim direktory As String, fName As String, fName2 As String

direktory = ThisWorkbook.Path & "\"
fName = Dir(direktory & "*.ASC")

Do While fName <> ""
    Set wb = Workbooks.Open(direktory & fName)
    fName2 = Left(fName, Len(fName) - 4) & ".xlsx"
    ActiveWorkbook.SaveAs fileName:=direktory & fName2, _
        FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    wb.Close savechanges:=False
    fName = Dir
Loop
End Sub

Cheers,
Tony
 
Upvote 0

Forum statistics

Threads
1,224,269
Messages
6,177,563
Members
452,784
Latest member
talippo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top