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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,941
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,191,002
Messages
5,984,100
Members
439,872
Latest member
noaman79

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
Top