PDA

View Full Version : Sum cell values if highligted Red



BENSON
09-05-2012, 04:36 AM
The code below Highlights any cell I double click on RED.
What I need help with, is further code to sum the values of the cells highlited and display the total in cel M167.The range of cells that will be highlighted is C1- CIOO


Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
' This macro is activated when you doubleclick
' on a cell on a worksheet.
' Purpose: color or decolor the cell when clicked on again
' by default color number 3 is red
If Target.Interior.ColorIndex = 3 Then
' if cell is already red, remove the color:
Target.Interior.ColorIndex = xlNone
Else
' make the cell red:
Target.Interior.ColorIndex = 3
End If
' true to cancel the 'editing' mode of a cell:
Cancel = True
End Sub

Bob Phillips
09-05-2012, 05:00 AM
See http://www.xldynamic.com/source/xld.ColourCounter.html