+ Reply to Thread
Results 1 to 3 of 3

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

  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

    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

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

    Hi

    Firstly

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    A function should only be used to return a result, not make a change to anything on the sheet. In this case, you are making a change to a cell format, so you should be using a sub.

    Try the code below. When it runs, you will be asked to highligh a range. Select the range A1:A10, and continue.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    03-21-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    6

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

    Thanks very much

+ 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