|问题:

对于输入或更改公式值,将使用先前的值进行证明。如果新的单元格值较高,则背景色应更改为

答案:

将下面的代码放入标准模块

Private Sub Worksheet_Calculate()

Dim rng As Range, rngAct As Range

Set rng = Me.UsedRange

With Worksheets("Dummy")

For Each rngAct In rng.Cells

If rngAct.Value < .Range(rngAct.Address).Value Then

rngAct.Interior.ColorIndex = 6

ElseIf rngAct.Value > .Range(rngAct.Address).Value Then

rngAct.Interior.ColorIndex = 3

End If

Next rngAct

.Range(rng.Address).Value = rng.Value

End With

End Sub

Sub OutOfOn()

With Worksheets("Dummy")

If .Visible = True Then .Visible = xlVeryHidden Else .Visible = True

End With

End Sub