Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello All,
I have a question on counting and sum the cells in a range that has color/conditional formatting. For example, I have Dim rng as Range rng = Range ("A1:Z1") Assuming that cells B1 (value = 100), D1 (value = 200), F1(value = 340) have color formatting (colorindex = 3) in the 'rng', the number of highlighted cells is 3. the sum of the highlighted celss = 100+200+340 = 640. Please help me translate into a VBA code. For each cell in rng if cell.interior.colorindex = 3 then count = "number of highlighted cells in the range" ---- how to translate this line into a VBA code? 'for this case, the output would be count = 3 sum = "the sum of the values in the highlighted cells" ---- how to translate this line into a VBA code? 'for this case, the output would be sum = 640 end if next cell Thanks for your help, -Thulasiram |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can you count cells by color? | Excel Worksheet Functions | |||
HOW DO I COUNT CELLS OF A CERTAIN COLOR ONLY? | Excel Worksheet Functions | |||
HOW TO FORMATE CELLS TO COUNT CELLS WITH A FILL COLOR? | New Users to Excel | |||
Count cells with the red color | Excel Worksheet Functions | |||
Count cells with the red color | Excel Worksheet Functions |