View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default VBA Code to sum shaded cells

Stacey,

Perhaps the easiest way would be to include a column of helper cells, each
with an IF condition that replicates the formula you have in you conditional
formatting, and the value to be summed if true.
eg
=IF(A2$A$1,B2,0)
where A2 is a date to be compared with a fixed date in $A1$ and B2 to be
summed. Copy the formula down and sum the helper column.
Or, look into SumIf or Sumproduct for a single formula solution.

Regards,
Peter T

"SMac" wrote in message
...
I have a worksheet that has over 3,000 rows and I have a COST column that

is
shaded when the DATE column is below a certain date (which I used

conditional
formating).

Now what I would like to do is added together all the shaded COST fields -
what do I need to write to accomplish this?

Thanks!
Stacey