fatalcore
02-01-2012, 03:37 AM
Hi,
I am using a script to basically highlight cells if the calculated value is not equal to the below value, and if the cell below it is blank then do nothing.
Strangely it is working with some value and not working in other value. Can somebody please rectify the code. I don't understand what is wrong in it.
Thanks in advance.
PS-I am attaching a dummy sheet for reference.
Sub TurnCellsYellow()
Dim c As Range
Selection.Interior.ColorIndex = xlNone
For Each c In Selection
If Not IsEmpty(c.Offset(1, 0)) Then
If c.Offset(1, 0) <> c Then c.Interior.ColorIndex = 6
End If
Next c
End Sub
I am using a script to basically highlight cells if the calculated value is not equal to the below value, and if the cell below it is blank then do nothing.
Strangely it is working with some value and not working in other value. Can somebody please rectify the code. I don't understand what is wrong in it.
Thanks in advance.
PS-I am attaching a dummy sheet for reference.
Sub TurnCellsYellow()
Dim c As Range
Selection.Interior.ColorIndex = xlNone
For Each c In Selection
If Not IsEmpty(c.Offset(1, 0)) Then
If c.Offset(1, 0) <> c Then c.Interior.ColorIndex = 6
End If
Next c
End Sub