Sum partucular cells by colour of sheet

G

Guest

Hi,

I have several sheets of different tab colours, ie, 5 green, 10 blue, etc. I need to be able to sum all 'A1' cells together if they are on a particular coloured tab, ie, "What is the sum of all Blue tab sheets cell A1?"

I would appreciate any help,

Many thanks.
 
P

papou

Hi Geoffers
Here's an example code:
N = 0
For Each s In ThisWorkbook.Worksheets
If Worksheets(s.Name).Tab.ColorIndex = 11 Then
N = N + Worksheets(s.Name).Range("A1")
End If
Next s
MsgBox "Sum of cells A1 in dark blue tab sheets is " & N

HTH
Cordially
Pascal



Geoffers said:
Hi,

I have several sheets of different tab colours, ie, 5 green, 10 blue, etc.
I need to be able to sum all 'A1' cells together if they are on a
particular coloured tab, ie, "What is the sum of all Blue tab sheets cell
A1?"
 
G

Guest

Thank you very much.

papou said:
Hi Geoffers
Here's an example code:
N = 0
For Each s In ThisWorkbook.Worksheets
If Worksheets(s.Name).Tab.ColorIndex = 11 Then
N = N + Worksheets(s.Name).Range("A1")
End If
Next s
MsgBox "Sum of cells A1 in dark blue tab sheets is " & N

HTH
Cordially
Pascal




I need to be able to sum all 'A1' cells together if they are on a
particular coloured tab, ie, "What is the sum of all Blue tab sheets cell
A1?"
 

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