+ Reply to Thread
Results 1 to 1 of 1

How to make a Code/Script for calculating values filtered by background colour

  1. #1
    Registered User
    Join Date
    10-14-2021
    Location
    Belgium
    MS-Off Ver
    365 ProPlus
    Posts
    1

    Question How to make a Code/Script for calculating values filtered by background colour

    Hello people,
    I'm new here so forgive me when I'm posting in the wrong section...
    I'm trying to calculate the weight of different coins that I have listed.
    I've given different material types of the coins a colour for each type.
    In this case I would like to calculate the weight of different silver coins by using their background colour.
    All values are in column "H".
    At the bottom of the sheet you can see the different materials, so in "H100" i would like to see how many different coins I have with that type of silver.
    In "I100" I would like to see the total weight of those same coins.
    Online I've found a code that would normally do the trick but because I'm using "merged cells" it gets calculated all wrong...
    Ideally would be a code where I could select the entire column "H" as all data regarding weight is in this column.

    This is the code i've tried but failed:

    PHP Code: 
    Function SOMZELFDEKLEUR(Gebied As RangeCel As Range) As Double
    Dim Kleur 
    As Integer
      Application
    .Volatile
      Kleur 
    Cel.Interior.ColorIndex
      
    For Each Cel In Gebied.Cells
        
    If Cel.Interior.ColorIndex Kleur And IsNumeric(Cel.ValueThen
          SOMZELFDEKLEUR 
    SOMZELFDEKLEUR Cel.Value
        End 
    If
      
    Next Cel
    End 
    Function 
    There's this SUBTOTAL function too but it's limited to 250 or so cells, if possible I would like an entire column

    If anybody could help me out... well that would make my year !!
    I'm no expert at all
    Regards,
    doc
    Attached Files Attached Files

+ 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. [SOLVED] Apply background colour and font colour on sheets following specific naming pattern
    By annazet in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-14-2018, 07:05 AM
  2. [SOLVED] format a cell background colour based on a manual background colour of an adjacent cell
    By Nampara in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-24-2018, 04:03 PM
  3. [SOLVED] Search cells based on student name, cell background colour and return a tally for colour
    By drof_06 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-26-2016, 04:31 AM
  4. Replies: 2
    Last Post: 01-05-2016, 06:36 PM
  5. Replies: 6
    Last Post: 03-23-2015, 10:19 AM
  6. Formula to check colour of text or colour of background
    By Wonderful World in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-07-2014, 01:49 AM
  7. [SOLVED] change a cell background colour to my own RGB colour requirements
    By Stephen Doughty in forum Excel General
    Replies: 4
    Last Post: 06-16-2006, 08:15 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