ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum partucular cells by colour of sheet (https://www.excelbanter.com/excel-programming/302778-sum-partucular-cells-colour-sheet.html)

Geoffers

Sum partucular cells by colour of sheet
 
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.



papou[_9_]

Sum partucular cells by colour of sheet
 
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" a écrit dans le message de
...
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.





Geoffers

Sum partucular cells by colour of sheet
 
Thank you very much.

"papou" wrote:

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" a écrit dans le message de
...
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.







All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com