+ Reply to Thread
Results 1 to 2 of 2

Subtotal Colored Cells from an Auto Filtered Column

  1. #1
    Registered User
    Join Date
    01-11-2005
    Posts
    2

    Subtotal Colored Cells from an Auto Filtered Column

    Please help?

    I am using the autofilter that is issuing the correct results. Some of the filtered cells have a colored background.

    I have used the below function to sum cells defined by the cell color - but wish to now sum all of the filtered cells that contain the background color.

    Dim rCell As Range
    Dim 1Col As Long
    Dim vResult

    1Col = rColor.Interior.ColorIndex

    If SUM = True Then
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = 1Col Then
    vResult = WorksheetFunction.SUM(rCell, vResult)
    End If
    Next rCell
    Else
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = 1Col Then
    vResult = 1 + vResult
    End If
    Next rCell
    End If

    ColorFunction = vResult
    ---
    I am not sure of the best way to go forward. Any guidance is appreciated.

  2. #2
    Registered User
    Join Date
    06-24-2009
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Subtotal Colored Cells from an Auto Filtered Column

    giday, I'm fairly new here so don't bark at me if I'm a no gooder lol.

    I think it's a good idea to have the numbers represent the color for interior (background color) so you can autofilter these numbers in color cells like e.g.

    3 is for red
    6 is for yellow
    and so on

    here the function code that you can copy and paste in your sheet in VBA

    Please Login or Register  to view this content.
    Then go to sheet that contain color cell. If you have color cell in B1 then type

    =GetInteriorColorIndex(B1)

    in B1

    It'll give you the number of your color. Therefore do the rest of the color cells and then autofilter the column

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1