VBA 格式单元格为常规
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37907606/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:28:32 来源:igfitidea点击:
VBA format cells to General
提问by BKChedlia
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 :
我想将一个 excel 文件格式化为“常规”,但它不适用于所有单元格(有些是自定义的,pourcentage ......)。这是我的代码:
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.
请帮忙。
回答by Gary's Student
If you want to format allcells to General, then use something like:
如果要将所有单元格格式化为General,请使用以下内容:
Sub dural()
ActiveSheet.Cells.NumberFormat = "General"
End Sub

