为什么两个函数结果不一致




Option Explicit
Sub Macro2()

    Dim i  As Integer
    For i = 5 To 219
        With ActiveSheet.Range("C" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(($C$" & CStr(i) & "=$E$" & CStr(i) & "),($E$" & CStr(i) & "=$F$" & CStr(i) & "),($F$" & CStr(i) & "=$G$" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("E" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(($C$" & CStr(i) & "=$E$" & CStr(i) & "),($E$" & CStr(i) & "=$F$" & CStr(i) & "),($F$" & CStr(i) & "=$G$" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("F" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(($C$" & CStr(i) & "=$E$" & CStr(i) & "),($E$" & CStr(i) & "=$F$" & CStr(i) & "),($F$" & CStr(i) & "=$G$" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("G" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(($C$" & CStr(i) & "=$E$" & CStr(i) & "),($E$" & CStr(i) & "=$F$" & CStr(i) & "),($F$" & CStr(i) & "=$G$" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
    Next i
End Sub



Option Explicit
Sub Macro3()

    Dim i  As Integer
    For i = 5 To 219
        With ActiveSheet.Range("C" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND((C" & CStr(i) & "=E" & CStr(i) & "),(E" & CStr(i) & "=F" & CStr(i) & "),(F" & CStr(i) & "=G" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("E" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND((C" & CStr(i) & "=E" & CStr(i) & "),(E" & CStr(i) & "=F" & CStr(i) & "),(F" & CStr(i) & "=G" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("F" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND((C" & CStr(i) & "=E" & CStr(i) & "),(E" & CStr(i) & "=F" & CStr(i) & "),(F" & CStr(i) & "=G" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
        With ActiveSheet.Range("G" & CStr(i))
            .FormatConditions.Delete
            .FormatConditions.Add Type:=xlExpression, Formula1:="=AND((C" & CStr(i) & "=E" & CStr(i) & "),(E" & CStr(i) & "=F" & CStr(i) & "),(F" & CStr(i) & "=G" & CStr(i) & "))"
            .FormatConditions(1).Interior.ColorIndex = 15
        End With
    Next i
End Sub

阅读更多
文章标签: integer c
个人分类: VBS OFFICE 问题
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭