exel 单元格数值变化,及时改变另一列显示背景颜色

Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Integer
    Dim j As Integer
    Dim r As Integer

    r = 1000

    For i = 1 To r

         If Cells(i, 6) = "" Or Cells(i, 6) = 0 Then
             Cells(i, 2).Interior.ColorIndex = 0
         End If
         If Cells(i, 6) > 0 Then
             Cells(i, 2).Interior.ColorIndex = 42
         End If
    Next
End Sub

 

 

posted on 2016-05-09 10:40  shortail  阅读(336)  评论(0编辑  收藏  举报