Hello
I have developed an Excel add-in which uses Application Event.
The foll code works quite well (but not perfectly)
Private Sub MyEventVar_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
MyEventVar.EnableEvents = True
If Target.Cells.Count > 0 Then '// PROBLEM IS HERE
With Target
'// Colouring the active cell yellow
.Worksheet.Cells.FormatConditions.Delete
.FormatConditions.Add xlExpression, , "TRUE"
.FormatConditions(1).Interior.Color = vbYellow
End With
End If
End Sub
What I want to do is this:
I want the active cell be be (temporarily) coloured yellow (because the inbuilt Excel cursor is not very visible, and there are many colours in my worksheet)
When ever you click a cell, its colour changes to yellow.
When you click another cell, the old cell becomes white again, and the new cell becomes yellow.
In brief, what I want is to highlight the current cell yellow.
Problem with my code
If I select more than 1 cell, the code works correctly. Even with 2 cells, or 3 cells etc
But if I select a SINGLE CELL (with my mouse), the cell does not turn yellow - and this is precisely what I want to achieve.
Can anybody help?
Thanks
Leon Lai