VBA format cells to General

醉酒当歌 提交于 2020-01-03 08:48:43

问题


I would like to format a excel file to "General", but it's not working for all cells (some are custom, pourcentage...). here is my code :

With ActiveSheet.Range("A1").Resize(LineIndex, 1)
    .Value = WorksheetFunction.Transpose(strLine)
    .NumberFormat = "General"
    'DEFINE THE OPERATION FULLY!!!!
    .TextToColumns Destination:=.Cells(1), DataType:=xlDelimited, _
                   TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, _
                   Tab:=False, Semicolon:=False, Comma:=False, Space:=False, _
                   Other:=True, OtherChar:="|"

help please.


回答1:


If you want to format all cells to General, then use something like:

Sub dural()
    ActiveSheet.Cells.NumberFormat = "General"
End Sub


来源:https://stackoverflow.com/questions/37907606/vba-format-cells-to-general

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!