+ Reply to Thread
Results 1 to 6 of 6

sum based on colour

  1. #1
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201

    sum based on colour

    Hi,

    i'm currently using some VBA code to insert a formula and sum certain rows. Which rows to sum is determined by the following line...

    Please Login or Register  to view this content.
    so basically, sum all rows until you get to one that has been coloured in. Is there any way to change this to say...do whilst colour index does not equal blue??...i've tried the following, but it does not work

    Please Login or Register  to view this content.


    here is the whole code, if that helps

    Please Login or Register  to view this content.
    thanks
    Last edited by Sharp; 10-17-2008 at 03:31 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Take a look at Chip Pearson's site

    http://www.cpearson.com/excel/colors.aspx
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    05-21-2004
    Location
    UK
    Posts
    136
    What is that code doing? I don't mean counting coloured cells, but what is the looping logic et al?

  4. #4
    Forum Contributor
    Join Date
    12-04-2006
    Posts
    201
    thanks Roy,

    in answer to your question 'XLD', it basically loops through the sheet, if 'Total' is entered into column 'B', then it will enter the sum formula in the columns specified. The sum will be above the row where total is until it hits a coloured cell...hope that makes sense

  5. #5
    Forum Contributor
    Join Date
    05-21-2004
    Location
    UK
    Posts
    136
    Is it just because the colorindex for blue is not 36 but 5? That seems to work for me.
    Last edited by xld; 10-17-2008 at 04:31 AM.

  6. #6
    Forum Contributor
    Join Date
    05-21-2004
    Location
    UK
    Posts
    136
    You can also simplify the code

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Count cell values based on text colour
    By mundo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2008, 09:25 AM
  2. Colour Change based on Text Value
    By Mark123456789 in forum Excel General
    Replies: 1
    Last Post: 12-04-2007, 05:52 PM
  3. IF formula based on background cell colour
    By mr_teacher in forum Excel General
    Replies: 1
    Last Post: 11-28-2007, 10:44 AM
  4. count entries based on colour
    By jimb0693 in forum Excel General
    Replies: 5
    Last Post: 05-02-2007, 10:48 AM
  5. Calculation based on font colour?
    By creationracing in forum Excel General
    Replies: 4
    Last Post: 02-13-2007, 02:42 PM

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