Percentage difference between numbers in 2 cells
Rajagopal
You could try pasting this event code into the code window for the worksheet
where you want to do the checking (NOT a normal code module)
Private Sub worksheet_change(ByVal Target As Range)
Dim CheckRange As Range
Dim CheckCell As Range
Set CheckRange = activesheet.Range("CheckRange") 'this could be
range("A1:A15")
For Each CheckCell In CheckRange
If CheckCell.Row CheckRange.Cells(1).Row Then 'don't check the
first cell in the range
If CheckCell.Value (CheckCell.Offset(-1, 0).Value * 1.05) Then
CheckCell.Font.ColorIndex = 3
Else
CheckCell.Font.ColorIndex = 1
End If
End If
Next
End Sub
Hope this helps
Pete
"Rajagopal" wrote:
Hi,
I have an excel sheet where I need to mark the rows in red colour if
the value in the current row is + or - 5% the previous row. Please suggest me
How I can do it.
Regards,
Rajagopal
|