Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub HighLightCells()
- ActiveSheet.UsedRange.Cells.FormatConditions.Delete
- ActiveSheet.UsedRange.Cells.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
- Formula1:=ActiveCell
- ActiveSheet.UsedRange.Cells.FormatConditions(1).Interior.ColorIndex = 4
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- call HighLightCells
- End Sub
- Sub HighlightCells()
- Dim rCell As Range
- If ActiveCell.Value = vbNullString Then Exit Sub
- Set rCell = ActiveCell
- Do
- Set rCell = ActiveSheet.UsedRange.Cells.Find(ActiveCell.Value, rCell)
- If rCell.Address <> ActiveCell.Address Then
- rCell.Interior.Color = 65535
- Else
- Exit Do
- End If
- Loop
- End Sub
Add Comment
Please, Sign In to add comment