+ Reply to Thread
Results 1 to 2 of 2

Module help for Average Black cells

  1. #1
    Registered User
    Join Date
    07-27-2010
    Location
    Hadera Israel
    MS-Off Ver
    Excel 2010/2013
    Posts
    16

    Module help for Average Black cells

    Hello,

    I have modified a module in order to average only cells written in black fonts how ever , it dosnt work... could anyone please tell me why ?

    Function AvgColors(rng As Range)
    Dim ce As Range, SumColors As Double, CountColors As Long
    For Each ce In rng
    If Cells(ce.Row, ce.Column).Font.ColorIndex = 1 Then
    SumColors = SumColors + ce.Value
    CountColors = CountColors + 1
    End If
    Next ce
    If CountColors = 0 Then
    AvgColors = 0
    Else
    AvgColors = SumColors / CountColors
    End If
    End Function


    Thanks!!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Module help for Average Black cells

    Hi Doctorteeth,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ 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