How to fix Excel file format error after saving and closing
How to fix Excel file format error after saving and closing: You have entered data and made a lot of edits to an Excel file such as font, color, size, table borders, etc. You have also saved the file and closed Excel. However, when you reopen it, the data inside is corrupted with font errors, or the formats you just saved have completely disappeared. What should you do then? In fact, fixing Excel file format errors or font errors is not difficult, but it is important to know how to do it. Read the following article to learn how to fix it.
If you open an Excel file with corrupted data format like the image below, follow the steps below to fix this issue.
1. Fixing by manually deleting Styles
In most cases, the reason why Excel files lose formatting after saving is due to excess Cell Styles. Therefore, you need to delete unnecessary Cell Styles. To do this, first select the Home tab on the toolbar. Then click on Cell Styles.
Now, the scroll bar will display the Styles available in your worksheet. You just need to find strange formats, foreign languages, etc. then right-click and select Delete to remove them.
2. Using VBA to automatically delete Styles
First, select the Developer tab on the toolbar. Then click on Visual Basic. Or you can use the shortcut key combination Alt + F11 to open the VBA window.
Now the VBA window appears, select the Insert tab on the toolbar. The scroll bar appears, select Module.
Next, copy the code below into the Module dialog box. Then click the Run icon on the toolbar or press F5 to run the code. That way, all the excess and corrupted Styles in your file will be quickly deleted.
Sub StyleKill()
Dim styT As Style
Dim intRet As Integer
On Error Resume Next
For Each styT In ActiveWorkbook.Styles
If Not styT.BuiltIn Then
If styT.Name <> “1” Then styT.Delete
End If
Next styT
End Sub
3. Choose the format when saving the file
Another cause of formatting errors when saving files is selecting the wrong file format. To save the file with the full format and without errors, you need to select Excel Workbook (*.xlsx) at the Save as type. That way, your Excel file will be saved normally without losing formatting.
So, the above article has guided you on how to fix Excel file format errors after saving and closing. Hopefully, the article will be helpful to you in your work. Wish you success!