View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default compare oldvalue and new value of a cell

Hi,


This may help. Right click your sheet tab, view code and paste this in

Private Sub Worksheet_Change(ByVal Target As Range)
If TargetVal < Target Then
Target.Interior.ColorIndex = 3
TargetVal = vbNullString
End If

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
TargetVal = Target
End Sub

Mike


"shiro" wrote:

Hi All,
how to write a code to compare the value of a cell
before it's being updated by user.If the new value
is different with the new value,I want the cell
background colour become different.But since
I have many sheet in my workbook,I want the code
become public and I try to keep the sheet clean
from any vba code.
Thank's

Shiro