[英]Excel General and Custom formatting
I want to be able to put the string "1 - 2" in an excel cell.我希望能够将字符串“1 - 2”放在一个 excel 单元格中。 I would be using this string later for other purposes.
我稍后会将此字符串用于其他目的。 As of now if I input "1 - 2" (or "1-2") it turns into "2-Jan" and the cell formatting changes from "General" to "Custom".
截至目前,如果我输入“1 - 2”(或“1-2”),它会变成“2-Jan”,并且单元格格式从“常规”变为“自定义”。 If I input "=1-2" I get "-1".
如果我输入“=1-2”,我会得到“-1”。 I don't want either of these answers.
我不想要这些答案中的任何一个。 I want the string to stay as "1 - 2" and the formatting of the cell to not change.
我希望字符串保持为“1 - 2”,并且单元格的格式不变。
Is there a way to do make sure the formatting does not change?有没有办法确保格式不会改变? Use of VBA code is fine.
使用 VBA 代码很好。
将单元格格式化为文本,而不是常规。
您可以在字符串前加上 '.
'1 - 2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.