Automatically change the cell from general to date

Closed
iamdinesh Posts 69 Registration date Tuesday December 4, 2012 Status Member Last seen March 9, 2018 - Updated on Mar 9, 2018 at 05:22 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 12, 2018 at 01:07 PM
Hello,





Somehow i am facing an issue again and again in my office 365 excel, when i save the file with general cells format for number values, when i again open the same file it automatically change the cell from general to date format it create lots of time to re-correct the file, and it is happening again and again when re open the file can someone help regarding to this issue

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Updated on Mar 12, 2018 at 01:12 PM
Hi Deesh,

Have you created the file using your current Excel version or is it an 'old' file that you are now opening with your current Excel version?

Might be a conversion issue. So try to recreate your workbook.

In case that fails. The following code will change all cells to number format with 2 decimals on all sheets upon opening your workbook. First you need to implement the code, save your workbook and then re-open to see the result.

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In Worksheets
    With ws
        .Cells.NumberFormat = "0.00"
    End With
Next ws
End Sub


Code needs to be placed under ThisWorkbook:

Hopefully this will solve/help with your unusual query.

Best regards,
Trowa