Results 1 to 3 of 3

How to define a function that can sum all cells' value and then return the color of sum?

Threaded View

bryansky How to define a function that... 03-26-2013, 12:33 AM
rylo Re: How to define a function... 03-26-2013, 01:03 AM
bryansky Re: How to define a function... 03-26-2013, 01:33 AM
  1. #1
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

    How to define a function that can sum all cells' value and then return the color of sum?

    I want to define a function that can sum all cells' value and then return the color of sum number
    For example, A1:A10 is 1 to 10, the sum of A1:A10 is 55, and at the same time the interior color of another cell would change to the color that the colorindex

     Function iSumColor(r As Range, v As Range) As Double
    Dim q As Range
        Dim result As Double
        result = 0
        For Each q In r
            
            result = result + q.Value
            
        Next
    
         Dim c As Range
         For Each c In q
         c.Interior.ColorIndex = result
    
        Next
    
       iSumColor = result
    
    End Function
    and I input the function "=iSumColor(A1:A10, B1)" in any cell, the cell should be 55, and the B1 cell's color should be color of index is 55, how do I do it?
    what's wrong with my syntax?
    Last edited by bryansky; 03-26-2013 at 01:25 AM.

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