Forum Discussion

  • Buddhadeb de's avatar
    Buddhadeb de
    Copper Contributor

    Hi 

     

    i have same kind report where need to do same task so i was made custom function in VBA and i have save  as  like  excel add-in . so i hope it will help .

    below code need to add in VBA its working fine.

     

    Function getsumbycolor(lookupcolor As Range, lookuparray As Range) As LongLong
    Dim colorsum As LongLong
    Dim colornumber As LongLong
    Dim rg As Range
    colorsum = 0

    colornumber = lookupcolor.Interior.Color

    For Each rg In lookuparray
    If rg.Interior.Color = colornumber Then
    colorsum = colorsum + rg.Value
    End If
    Next rg
    getsumbycolor = colorsum

    End Function

     

     

    Thanks 

    Buddhadeb De

Resources