Skip to content
本页内容

NumberFormat (属性)

在条件格式规则的计算结果为 True 时返回或设置应用于单元格的数字格式。Any 型,可读写。

说明

数字格式是使用**“单元格格式”对话框的“数字”**选项卡上显示的相同格式代码指定的。您可以使用内置的数字格式,例如 "General" 或者创建自定义数字格式。

示例

python
#本示例显示第一张工作表上单元格区域 C1:C10 的第二个(Top10)条件格式所应用于的数字格式
def test():
    top = Application.Worksheets.Item(1).Range("C1:C10").FormatConditions.Item(2)
    print(top.NumberFormat)
python
#本示例设置活动工作表上单元格区域 C1:C10 的第一个(Top10)条件格式所应用于的数字格式
def test():
    top = ActiveSheet.Range("C1:C10").FormatConditions.Item(1)
    top.NumberFormat = "0.00"