【问题标题】:Number format displayed differently in the formula bar and cell vba数字格式在公式栏和单元格 vba 中显示不同
【发布时间】:2015-10-01 22:18:34
【问题描述】:

我使用了 ActiveCell.Numerformat= "(0)" 。该值在单元格中显示为带括号,但公式栏显示的值不带括号。

由于上述问题,我没有使用 Numberformat,而是在数字后面加上括号

var= "(" & value & ")" 

将 var 写入单元格后,它显示为 -450 而不是 (450)

这两种方法都不适合我。有什么帮助吗?我对 vba 和 excel 格式感到困惑。

【问题讨论】:

  • 0 与 (0) 相同。公式栏显示的是实际值,而不是格式化的值。
  • 如果你总是想在你的数字周围加上括号,然后使用单元格格式,就像你对 NumberFormat.. 所做的那样。当你添加 更多 括号时分配单元格值。

标签: vba excel vb6


【解决方案1】:

考虑:

Sub Macro2()
    ActiveCell.NumberFormat = """(""General"")"""
End Sub

或:

Sub Macro2()
    ActiveCell.NumberFormat = """(""0"")"""
End Sub

【讨论】:

  • 两者都没有类似于 ActiveCell.NumberFormat = "(0)"
猜你喜欢
  • 2022-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多