Suming cells by colour

siddhartharao

New Member
Joined
Mar 26, 2009
Messages
1
Hi all,

how can you sum values, across worksheets, of various cells that are all the same colour? i.e. I would like the sum of all cells in the workbook that are filled in BLUE? Is this possible?

Thanks,

Sid
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to the Board!

This should do it for you, but you are a bit vague on what you want exactly and how you want the outcome displayed, so it is just a message box:

Code:
sub sumcolor()
for each ws in worksheets
for each c in ws.usedrange
if c.interior.colorindex = 5 then total = total + c.value
next c
next ws
msgbox total
end sub
You also didn't specify any columns or ranges so this goes through the used range of each sheet and may take some time to run depending on your sheets?

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,344
Members
448,956
Latest member
Adamsxl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top