Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Count shaded cells

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    How do I count cells that are shaded, i.e., yellow fill.


  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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 ||||. This makes it easier to count the total. (Sorry it's lunchtime, I get sarky at lunchtime)

    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. #3
    Board Regular Brian from Maui's Avatar
    Join Date
    Feb 2002
    Posts
    8,450
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Posts
    363
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #5
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks for the VBA.
    I guess the other method will work as well

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •