Hello,
below code flashes cell when value changes, it saves value of original cell b and save its and compares,
however when the value of cell is based on another cell or based on a formuae, then this code doesnt work, please help
below code flashes cell when value changes, it saves value of original cell b and save its and compares,
however when the value of cell is based on another cell or based on a formuae, then this code doesnt work, please help
Code:
PrivateSub Worksheet_Change(ByVal Target As Range)Dim KeyCells As Range
Set KeyCells = Range("B1:B27")
IfNot Application.Intersect(KeyCells, Range(Target.Address)) _IsNothingThenIf Target.Value > Cells(Target.Row,5).Value Then'flash green
Target.Interior.ColorIndex =10
Pause 0.5
Target.Interior.ColorIndex =2
Pause 0.5
Target.Interior.ColorIndex =10ElseIf Target.Value < Cells(Target.Row,5).Value Then'flash red
Target.Interior.ColorIndex =3
Pause 0.5
Target.Interior.ColorIndex =2
Pause 0.5
Target.Interior.ColorIndex =3EndIf
Cells(Target.Row,5).Value = Target.Value
EndIfEndSub
'Pauses execution without holding up main UI threadPublicFunction Pause(NumberOfSeconds AsVariant)OnErrorGoTo Error_GoToDim PauseTime AsVariantDim Start AsVariant
PauseTime = NumberOfSeconds
Start = Timer
DoWhile Timer < Start + PauseTime
DoEvents
Loop
Exit_GoTo:OnErrorGoTo0ExitFunction
Error_GoTo:
Debug.Print Err.Number, Err.Description, Erl
GoTo Exit_GoToEndFunction