【问题标题】:vba How to custom format cells without changing valuevba 如何在不更改值的情况下自定义格式单元格
【发布时间】:2016-04-19 16:13:36
【问题描述】:

百分比等工作正常,但自定义格式不允许我稍后对 nuber 求和。 .NumberFormat = "0.0%"

我有一系列尺寸并尝试过这个: .NumberFormat = "0.0mm" 或者 (公式)&“mm”

它看起来是正确的,但我无法将此单元格与其他数字单元格相乘,因为它会将其读取为文本。

有什么建议吗?

【问题讨论】:

  • 以下对我有用.NumberFormat = "0.0 \m\m" 它保留数字并应用掩码,因此8.8 被视为8.8 mm,同时保留数字以在其他公式中使用。
  • 谢谢斯科特。完美工作:)

标签: excel vba number-formatting


【解决方案1】:

选择单元格并运行:

Sub MilliMeters()
    Dim r As Range
    For Each r In Selection
        r.NumberFormat = "General"" mm"""
    Next r
End Sub

【讨论】:

    【解决方案2】:

    谢谢斯科特。这行得通。 .NumberFormat = "0.0 \m\m"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-20
      • 2012-07-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-05
      • 1970-01-01
      相关资源
      最近更新 更多