+ -
当前位置:首页 → 问答吧 → 一段条件格式的代码出错"下标越界",请善知识指点。

一段条件格式的代码出错"下标越界",请善知识指点。

时间:2011-08-05

来源:互联网

以下为一段录制的条件格式代码,为所选区域("R3:R9")加条件格式,
Range("R3:R9").Select
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .Color = 65535
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    With Selection.FormatConditions(1)   运行到这里错误 下标越界
        .MinPoint.Modify newtype:=xlConditionValueLowestValue
        .MaxPoint.Modify newtype:=xlConditionValueHighestValue
    End With
    With Selection.FormatConditions(1).BarColor
        .Color = 8700771
        .TintAndShade = 0
    End With

进行调试时,运行到这段With Selection.FormatConditions(1),  出现下标越界错误,问题是FormatConditions是EXCEL系统内部变量,怎么会出现下标越界呢? 请善知识指点,谢谢!

作者: 32283377   发布时间: 2011-08-05

1,你的版本不是2003的?
2,你用的是修改条件格式modify,而不是加add
请查阅帮助文件。

作者: 蓝桥玄霜   发布时间: 2011-08-05

相关阅读 更多