I have code that changes a cell fill to yellow when clicked... and back to blank when clicked again. This works fine.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = IIf(Target.Interior.ColorIndex >= 6, -4142, 6)
End Sub
I'm using a UDF to sum cells by color with this, and this too works fine.
Function SumByColor(CellColor As Range, rRange As Range)
Dim cSum As Long
Dim ColIndex As Integer
ColIndex = CellColor.Interior.ColorIndex
For Each cl In rRange
If cl.Interior.ColorIndex = ColIndex Then
cSum = WorksheetFunction.SUM(cl, cSum)
End If
Next cl
SumByColor = cSum
End Function
Finally, I'm using
and this works... but I want it to work at each cell click within F3:F5.
How do I make this formula fire when clicking in cell F3:F5? Seems like it should do it but I can't make it work. The only way it will work is if I click in the cell with the formula and hit enter.
I believe I need a selection change event. Am I correct?
Thanks for all you guys much smarter at this than I am. See attached picture.
Excel1.png
Bookmarks