Results 1 to 4 of 4

Calculating cells based on the condition of color, but color is chosen via DROPDOWN choice

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2014
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Talking Calculating cells based on the condition of color, but color is chosen via DROPDOWN choice

    .....so it doesn't work. It will work if I manually select a cell color, but that is impossible for this purpose I need certain cells to calculate into another cell per the color that is affixed to the dropdown choice.

    This VBA worked for NON-DROPDOWN colored cells:

    Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
    Dim rCell As Range
    Dim lCol As Long
    Dim vResult
    lCol = rColor.Interior.ColorIndex
    If SUM = True Then
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = WorksheetFunction.SUM(rCell, vResult)
    End If
    Next rCell
    Else
    For Each rCell In rRange
    If rCell.Interior.ColorIndex = lCol Then
    vResult = 1 + vResult
    End If
    Next rCell
    End If
    ColorFunction = vResult
    End Function
    Can anyone help? Oh thank you!

    -T
    Last edited by teanza; 01-07-2014 at 12:45 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. change fill color of a range of cells based on color of a cell?
    By DarMelNel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 04:48 PM
  2. [SOLVED] Color Index to sum up cells based on background color
    By jph89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2013, 03:23 PM
  3. [SOLVED] Color cells in Range based on condition.
    By gammaman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-24-2012, 10:27 AM
  4. How do i auto fill cell color based on other cells' color?
    By Kchatza in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2012, 05:00 AM
  5. How to color the cell based on some condition?
    By ananthakumar.e in forum Excel General
    Replies: 3
    Last Post: 03-07-2008, 10:16 AM

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