sum of only green cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I sum e.g. only green cells in my worksheet, when I color the cells in
two different colors, green and red?
 
try
Sub addcolorcells()
For Each c In Selection
If c.Interior.ColorIndex = 4 Then ms = ms + c
Next
MsgBox ms
End Sub
 
Jan

Depends on how the cells became colored.

If by using Conditional Formatting, count using the same conditions.

If not by CF you will need VBA code to count by color. See Chip Pearson's
site at

http://www.cpearson.com/excel/colors.htm

Gord Dibben Excel MVP

On Mon, 6 Sep 2004 11:51:02 -0700, "Jan Caesar" <Jan
 

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

Back
Top