How to change Format of a Cell to Text using VBA

前端 未结 4 1364
一整个雨季
一整个雨季 2020-12-03 04:34

I have a "duration" column in an Excel sheet. Its cell format always changes — I want convert the duration from minutes to seconds, but because of the cell formatt

4条回答
  •  不思量自难忘°
    2020-12-03 04:42

    One point: you have to set NumberFormat property BEFORE loading the value into the cell. I had a nine digit number that still displayed as 9.14E+08 when the NumberFormat was set after the cell was loaded. Setting the property before loading the value made the number appear as I wanted, as straight text.

    OR:

    Could you try an autofit first:

    Excel_Obj.Columns("A:V").EntireColumn.AutoFit
    

提交回复
热议问题