COUNT HIGHLIGHTED CELLS IN A ROW ?

  • Thread starter Stephen the computer dummy
  • Start date
S

Stephen the computer dummy

I would like figure out how to add highlighted cells in a row with a
designated cell for the sum. If anyone can help it would make my spreadsheet
much more effective and easier to manage.
Thanks
topcat
 
M

Mike H

Hi,

You can do it with a UDF. Alt + F11 to open VB editor. Right click 'This
Workbook' and insert module and paste this in

Function SumColours(sumrange As range, colour As Long)
For Each c In sumrange
If c.Interior.ColorIndex = colour And IsNumeric(c) Then
mytot = mytot + c
End If
Next
SumColours = mytot
End Function

On the worksheet call with
=sumcolours(A1:A100,3)

Where A1:A100 is the range to sum
3 is the colour (Red)

If you dont know the colour numbers record a macro of colouring cells


Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top