![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 2
|
How do I count cells that are shaded, i.e., yellow fill.
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
Go through them one at a time and put an | down for every shade cell. Then every multiple of 5 put a bar across like this
Seriously, how do you want to do this? Do you want to use VBA? I don't know how you'd do it otherwise. _________________ [b] Mark O'Brien [ This Message was edited by: Mark O'Brien on 2002-04-09 09:39 ] |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 7,743
|
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
Try this:
Sub yellow_count() lastcell = Cells.SpecialCells(xlCellTypeLastCell).Address firstcell = "A1" Range(firstcell & ":" & lastcell).Select For Each cell In Selection If cell.Interior.ColorIndex = 6 Then x = x + 1 Next MsgBox x & " cells are yellow" End Sub
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#5 |
|
New Member
Join Date: Apr 2002
Posts: 2
|
Thanks for the VBA.
I guess the other method will work as well |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|