Hi everyone,
I got a code in internet that highlight a cell with equal value after double clicking a cell.
But my problem is I want to clear highlighted cell after clicking another cell (making double clicked cell inactive).
If you can edit this code it would be perfect. Thanks in advance
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Dim c As Range
Dim FirstAddress As String
Dim wksh As Worksheet
Static ColIdx
Cancel = True
If IsEmpty(ColIdx) Then ColIdx = 3 Else ColIdx = ColIdx + 1
If ColIdx > 16 Then ColIdx = 3
ActiveCell.Interior.ColorIndex = ColIdx
For Each wksh In ThisWorkbook.Worksheets
With wksh.Range("A11:A150")
Set c = .Find(ActiveCell.Value, lookat:=xlWhole)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
c.Interior.ColorIndex = ColIdx
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
Next wksh
End Sub
Bookmarks